Conversation
…ctories Git's relative --git-common-dir is computed from the physical working directory. Joining it with path.resolve walked out of a symlink into a repository subdirectory, so checkpoint capture wrote its index into a missing directory or a different repository. Ask for an absolute common dir in checkpoint capture and repository path lookup. The regression tests create the decoy repository before the only lookup, so a cached pre-decoy result cannot hide the wrong path. Co-authored-by: maco <macodev00@users.noreply.github.com>
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 project through a symlink that points at a repository subdirectory made every turn fail checkpoint capture with exit 128. Git's relative
--git-common-diris computed from the physical working directory, andpath.resolveapplied..to the symlink string, so the temporary index was created in a directory that does not exist. When that lexical path happened to exist, the index was written into a different repository. Diffs and Go back stayed unavailable for that thread.The same join in repository path lookup could cache the missing directory, or the other repository's
.git.Accepted in pingdotgg#13187.
Change
Checkpoint capture and repository path lookup now ask Git for an absolute
--git-common-dirbefore joining it with the project path.realPathstill runs afterward so Windows 8.3 short names collapse.The regression tests plant a decoy repository at the lexical common-dir path before the only lookup. Checkpoint capture records
GIT_INDEX_FILEduring the command and requires that directory to be the real.git. Repository listing callslistRefsonce, on a cwd that has never been resolved, and requiresdecoy-onlyto be absent andreal-onlyto be present. A secondlistRefson the same cwd would be served from the refresh cache and would not check the decoy.Fixes pingdotgg#13187
Supersedes pingdotgg#13223
Scope and approval
Server checkpoint and repository-path resolution only. No UI, contract, or provider changes.
pingdotgg#13187 was triaged and accepted as a server checkpoint bug: pingdotgg#13187 (comment)
Verification
Node v24.13.1, Linux. From
apps/serverat7e895b123:Result: 2 files passed, 156 tests passed (16.64s).
The same two tests were also run against the previous
path.resolvejoin, with the decoy repository already in place:Result: 2 failed. Checkpoint capture recorded
GIT_INDEX_FILEunder<sandbox>/.git(the decoy) instead of<sandbox>/repo/.git.listRefsreturned thedecoy-onlybranch (expected true to be falseon the decoy assertion). With the absolute common dir, that filtered run passed: 2 files passed, 2 tests passed, 154 skipped (1.91s).Result:
tsc --noEmitexited 0 (cache disabled). The compiler printed suggestion diagnostics in unrelated files and noerror TSlines.Limitations
Checked on Linux, where symlink creation is supported, so the new
skipIf(!symlinksSupported)cases ran. Not checked on Windows.