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

Use repository mutex more sparingly. Don't hold it while running git status. #12489

Merged
merged 2 commits into from
May 30, 2024

Conversation

maxbrunsfeld
Copy link
Collaborator

Previously, each git Repository object was held inside of a mutex. This was needed because libgit2's Repository object is (as one would expect) not thread safe. But now, the two longest-running git operations that Zed performs, (status and blame) do not use libgit2 - they invoke the git executable. For these operations, it's not necessary to hold a lock on the repository.

In this PR, I've moved our mutex usage so that it only wraps the libgit2 calls, not our git subprocess spawns. The main user-facing impact of this is that the UI is much more responsive when initially opening a project with a very large git repository (e.g. chromium, webkit, linux).

Release Notes:

  • Improved Zed's responsiveness when initially opening a project containing a very large git repository.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 30, 2024
Move the mutex into the RealGitRepository implementation.
This allows other fast git operations to run while a `git status`
process is still running.
@maxbrunsfeld maxbrunsfeld merged commit 8f942bf into main May 30, 2024
8 checks passed
@maxbrunsfeld maxbrunsfeld deleted the repo-lock branch May 30, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant