Skip to content

fix(web): keep PR diffs open when a file becomes a directory - #7

Closed
cestercian wants to merge 1 commit into
mainfrom
cursor/fix-pr-diff-path-collision-69f9
Closed

cestercian wants to merge 1 commit into
mainfrom
cursor/fix-pr-diff-path-collision-69f9

Conversation

@cestercian

@cestercian cestercian commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

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.

DiffFileTree now detects that prefix collision and shows a flat file list that keeps every changed path and its selection target, instead of handing both office and office/config.ts to 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, add office/config.ts). resetPaths / batch then 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

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Cursor Grok 4.6

Open in Web Open in Cursor 

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>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 21, 2026
@cestercian

Copy link
Copy Markdown
Owner Author

upstream opened

@cestercian cestercian closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant