Repository navigation
fix(web): keep PR diffs open when a file becomes a directory - #7
Closed
cestercian wants to merge 1 commit into
Closed
cestercian wants to merge 1 commit into
cestercian wants to merge 1 commit into
Conversation
Git can replace a file or symlink with a directory of the same name (and the reverse). Pierre's tree cannot represent both, so opening those diffs crashed the sidebar. Detect the prefix collision and show a flat file list instead of handing the colliding paths to the tree. Co-authored-by: Cestercian <yashafaid@gmail.com>
Owner
Author
|
upstream opened |
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.
What Changed
The PR/diff file sidebar no longer crashes when git replaces a file or symlink with a directory of the same name, or the reverse.
DiffFileTreenow detects that prefix collision and shows a flat file list that keeps every changed path and its selection target, instead of handing bothofficeandoffice/config.tsto Pierre's tree.Why
Pierre's tree is a single filesystem: a path cannot be a file and a directory at once. A valid git patch can include both (delete
office, addoffice/config.ts).resetPaths/batchthen threw while creating a directory that is already a file, so the PR diff could not be opened.Ordinary diffs still use the tree. The fallback covers initial construction, the reverse transition, a later PR slice that introduces the colliding descendant, and a refresh of the same set.
UI Changes
Happy-path tree chrome is unchanged. Only colliding diffs fall back to a flat list of the original paths.
Checklist
Cursor Grok 4.6