Conversation
Git can delete a file and add a directory of the same name in one diff. Pierre's tree throws if both paths are inserted. Give that file a distinct tree path and translate selection back to the diff path. Fixes pingdotgg#12887.
Owner
Author
|
Opened upstream. |
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.
Problem
Opening a PR diff crashes when git replaces a file or symlink with a directory of the same name, or the reverse. Pierre's file tree is one filesystem, so
officeplusoffice/config.tsthrowsPath collides with an existing file while creating directory "office"while the sidebar callsresetPathsorbatch. The diff never opens. The same sidebar is the PR Code tab and the regular Diff panel on web and desktop.Fixes pingdotgg#12887.
Change
diffFileTreeModeldetects a path that is a slash-bounded prefix of another path and gives that file a distinct tree path. The row label stays the file name. Selection, reveal, and git status translate back to the diff path. Ordinary diffs keep the original path array, so their tree is unchanged.A later PR slice that introduces the collision rebuilds the tree, because Pierre cannot rename the existing file into a directory in place. A refresh of the same set still updates in place and keeps folders the reader collapsed.
Scope and approval
pingdotgg#12887 is an accepted bug. The crash and the
officesegment are confirmed on the issue. This stays in the shared diff file tree. Mobile review does not use it. No contract or server change.Verification
Node v24.13.1.
vpis Vite+ fromnode_modules/.bin/vp. Commands from the repo root, with Node 24 first onPATH.Exit 0.
That includes the raw
["office", "office/config.ts"]list throwing inside Pierre, the rewritten list loading, the reverse order, a nested path, a chain of prefixes (a,a/b,a/b/c), a later slice applied withbatch, a refresh that rebuilds withresetPaths, and React selection of both files returning the real diff paths. A shared string prefix (officeandofficer.ts) is left unchanged.Exit 0. All matched files use the correct format.
Exit 0. No findings.
Exit 0.
tsc --noEmitinapps/web.Limitations
No client screenshot. Ordinary diffs are the same tree. The colliding case stays in that tree instead of a new list, and both paths select the real diff file in the component test. I did not open the PR Code tab or Diff panel in a running app, and I did not use the original unnamed pull request. The regression pair is
officeandoffice/config.ts.Grok 4.7, Cursor cloud agent.