mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 23:20:18 +01:00
1a28cff4b4
# Objective Fixes #64078 Opening a commit from the git panel, git graph, or blame waits until any in-flight fetch, pull, or push has finished. `show` and `load_commit_diff` went through the per-repository serial job queue, so a click on a commit sat behind the whole network round trip. ## Solution Commit reads are addressed by SHA, so their result doesn't depend on what else is queued. This takes them off the queue the way #62536 did for blob reads: 1. `Repository::show_commit` and `Repository::load_commit_diff` spawn directly instead of going through `send_job`, bounded by the same semaphore as blob reads, and return a `Task` instead of a `oneshot::Receiver`. 2. The semaphore is renamed from `blob_read_limiter` to `object_read_limiter` since it now covers commits too. 3. `Repository::show` stays queued for the ref picker, which passes branch and tag names rather than shas. Both share one body in `show_internal`. `handle_show` serves both from the same `GitShow` message, so it routes by whether the payload parses as a full object id, which is how git itself resolves a 40-hex string. Worth noting one behaviour change in shallow clones: opening a boundary commit while `git fetch --unshallow` is already running used to wait for the fetch, and now shows the shallow boundary notice straight away with the button disabled until the fetch completes. The "Fetch Full History" button itself awaits the fetch explicitly before reloading, so it is unaffected. ## Testing Added three tests: - `git_store::tests::test_commit_reads_do_not_wait_on_job_queue` holds the job queue with a job that never completes and asserts `show_commit` and `load_commit_diff` resolve anyway, while `show` still waits. It fails on `main` with `show_commit waited on the job queue`. - `git_store::tests::test_commit_reads_share_object_read_limit` holds every permit with blob reads and asserts both commit reads wait until one is released. - `collab::git_tests::test_show_rpcs_are_routed_by_revision_kind_on_host` has a guest send `GitShow` with a sha and with a ref name while the host queue is held; the sha is answered, the ref name waits. Green: `cargo test -p project --lib git_store` (22), `cargo test -p git_ui --lib` (157), `cargo test -p collab --test collab_tests git_tests` (13), `./script/clippy`. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments — none added - [x] The content adheres to Zed's UI standards — no UI changes - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase Five-commit repository with a remote that holds every fetch for ten seconds. Fetch is clicked, then commits in the History tab. **Before** https://github.com/user-attachments/assets/6c79f870-62cd-487b-be9f-7eefbb52b008 **After** https://github.com/user-attachments/assets/30680d1d-f19f-4407-90bf-11054ff3dd69 --- Release Notes: - Fixed commit details and diffs waiting behind an in-progress fetch, pull, or push before opening