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

Git status refinements and support vfs/gvfs repos #3556

Merged
merged 6 commits into from
Aug 7, 2024

Conversation

DefaultRyan
Copy link
Member

@DefaultRyan DefaultRyan commented Aug 6, 2024

Summary of the pull request

  • Re-use and cache command-line git repo status for individual files.
    • This is so we no longer have any "status" calls to LibGit2Sharp that could trigger a filesystem traversal to inadvertently over-hydrate the repo. Remaining libgit2sharp calls should not traverse the file tree for status, and any status calls will go through the command-line which is enlightened about VFS/GVFS.
  • Use FileSystemWatcher to look for file changes that could invalidate the cached status.
  • Throttle file system events to not flood the system with command-line status invocations.
  • Notify the Shell when a file status changes.

References and relevant issues

Detailed description of the pull request / Additional comments

There's some code movement here to move GitRepositoryStatus and GitStatusEntry from RepositoryWrapper.cs to their own files.

Introduced StatusCache which caches the most-recently obtained status and queues status updates in response to filesystem changes in the repo.

These updates are throttled so that if multiple file events arrive rapidly, we don't fetch another status update until the prior one has completed and the waiting period expires (currently 3 seconds).

Validation steps performed

Built a private DevHome build.

Verified that file status still appears as expected. Verified that file and repo status both eventually report the correct status after making multiple rapid file changes.

Attached a debugger with printing breakpoints to validate that even when making multiple rapid file changes, the status is only updated after a 3 second delay.

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

@DefaultRyan DefaultRyan changed the title Git status refinements Git status refinements and support vfs/gvfs repos Aug 6, 2024
@DefaultRyan DefaultRyan merged commit 269a79a into main Aug 7, 2024
4 checks passed
@krschau krschau added this to the Dev Home v0.17 milestone Aug 7, 2024
@DefaultRyan DefaultRyan deleted the user/defaultryan/gitstatuscache branch August 9, 2024 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants