Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Poll on Git status #1201

Open
cyn0 opened this issue Dec 9, 2022 · 2 comments
Open

[Question] Poll on Git status #1201

cyn0 opened this issue Dec 9, 2022 · 2 comments

Comments

@cyn0
Copy link

cyn0 commented Dec 9, 2022

HI,
We are using Git Jupyterlab extension on a directory mounted by S3-fuse. Poll on status api triggers git diff --numstat -z --cached 4b825dc642cb6eb9a060e54bf8d69288fbee4904 exec which in triggers burst of s3 API requests.

Question:
Why we do need to compare current stage with empty tree (from using --cached 4b825dc642cb6eb9a060e54bf8d69288fbee4904) to render the diff in the extension UI? I modified the plugin to use git diff --numstat -z (which doesnt trigger too many S3 requests) and I see that same information in the extension as before. I am interested in use-cases that would require us to compare current stage with empty tree.

Thanks a lot for your help in advance!

@welcome
Copy link

welcome bot commented Dec 9, 2022

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@fcollonval
Copy link
Member

@cyn0 This command is executed to determine if a file is binary or not. We are comparing to an empty tree to be able to get the information what ever the current git status of a file (typically if there is no diff it will not be possible to get that information).

Although in that precise case it indeed does not make sense to look for unchanged files.

As that information is not transient (there is a few chance a file with a given path will switch from textual to binary type), the best path seems to use _is_binary when polling the status and add a async cache on that method.

Feel free to start a PR and I will help you getting it through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants