Open non-writeable files in Capability::Read mode - #57202
Merged
Veykril merged 2 commits intoJul 10, 2026
Merged
Conversation
Veykril
enabled auto-merge
July 10, 2026 09:40
This was referenced Jul 31, 2026
jolutz
pushed a commit
to jolutz/zed
that referenced
this pull request
Aug 8, 2026
Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes zed-industries#57174 Release Notes: - Open non-writeable files in Capability::Read mode Co-authored-by: Lukas Wirth <lukas@zed.dev>
Pa1eShad0w
added a commit
to Pa1eShad0w/zed
that referenced
this pull request
Aug 19, 2026
…e tab Perforce keeps every file that is not open for edit read-only on disk. Since upstream zed-industries#57202, which landed in v1.12.0 and reached this fork through the v1.11 -> v1.15 uptake, a file that is read-only on disk opens in Capability::Read: the tab gets a lock icon and the editor refuses keystrokes. That deadlocks auto-checkout. Both hooks that run `p4 edit` are triggered by an edit or a save, and neither can happen while the buffer is locked, so the user has to click the lock by hand before they can work. The capability is also a one-shot snapshot taken in `load_file` and is never recomputed, and `BufferStore::open_buffer` returns the cached buffer for a path, so reopening the file after a successful checkout keeps the stale lock. `open_buffer` now peeks synchronously: a read-only file whose path resolves to an already-resolved Perforce repository, with `perforce.edit_on_file_save` on, opens editable. When the peek cannot answer - no repository discovered yet, or its backend has not resolved - the buffer opens locked exactly as upstream does and a background task settles it via `is_perforce_resolved`. Nothing on the open path awaits Perforce: doing so would tie opening a file to `p4 info` reaching the server, so a user whose server is unreachable could no longer open files at all. `GitStore` retries the still-locked buffers when it discovers a repository, which covers discovery racing session restore. Only buffers this store locked itself are unlocked, and only while they are still Capability::Read, so `worktree.read_only_files` and tabs the user locked by hand are untouched. Git and non-VCS files keep upstream's behavior. The decision itself is covered by tests in the crate's integration target; the crate sets `[lib] test = false`, so a `#[cfg(test)]` module under `src/` would never run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
playdohface
pushed a commit
to playdohface/zed
that referenced
this pull request
Aug 29, 2026
Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes zed-industries#57174 Release Notes: - Open non-writeable files in Capability::Read mode Co-authored-by: Lukas Wirth <lukas@zed.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Self-Review Checklist:
Closes #57174
Release Notes: