Repository navigation
Conversation
…arrytan#3101) In a linked worktree, a submodule or a --separate-git-dir repo, git answers --git-path with an absolute path, and Git for Windows writes it as C:/... gstack-wtree only treated /... as absolute, so it re-rooted that path under the worktree. With a private object directory (gstack-review-log --start) the repository's objects went missing, the fingerprint was empty, and /review and /ship could not record a review start. Without one, the index copy silently fell back to the slower read-tree seed. Accept [A-Za-z]:[\/]... as absolute in both case blocks, the idiom gstack-hook-check already uses and the check gstack-slug already makes for --git-common-dir. The new test runs a real linked worktree through explicit bash, so the Windows lane exercises Git for Windows itself, and on Linux and macOS reproduces the drive-letter answer with a git shim. Fixes garrytan#3101 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Contributor
|
Adopted in v1.91.89.0 (e6edff0, #3140). |
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.
Why (in your own words)
On Windows,
/reviewand/shipcannot record a review start inside a linked git worktree.gstack-review-log --startstops withcannot capture a diff review without a working-tree fingerprint, becausegstack-wtreeexits 1. The cause is one classification: Git for Windows answersgit rev-parse --git-path index|objectswith a drive-letter absolute path (C:/…) wherever that path is absolute.gstack-wtreeonly treated/…as absolute, so it glued the worktree root in front (C:/…/wt/C:/…/repo/.git/objects), and the private object directory lost the repository's objects.Fixes #3101. The same answer shape comes from submodules and
--separate-git-dirrepos (checked on Linux: all three print absolute--git-pathoutput; a main checkout prints.git/…), so those are fixed on Windows too. Not a duplicate of #3088/#3100: that isgstack-hook-check's argv spelling, a different file and mechanism.Why this shape
This is @dmfrede's fix from the issue, verified there through a full
/shiprun on Windows, written in the idiombin/gstack-hook-check:56already uses ([A-Za-z]:[\\/]*);bin/gstack-slug:178,182makes the same check for--git-dir/--git-common-dir. The test copies the shape of #2805'stest/ship-hook-windows-paths.test.ts(same bug class: a linked worktree's--git-pathanswer on Windows): a real linked worktree through explicitbash, force-included in the Windows lane, plus askipIf(win32)path-spelling simulation for Linux and macOS. CONTRIBUTING's wave rule: if two PRs fix the same thing, keep the smaller one. This is 3 files on currentmain, and fine to absorb into a wave.Not followed: the issue's backslash note is covered by the same bracket rather than a second pattern.
What it does
bin/gstack-wtree: bothcaseblocks treat[A-Za-z]:[\\/]*as absolute; the comment above them says why.test/gstack-wtree-windows-paths.test.ts(new): a linked worktree with a private object directory must fingerprint asHEAD^{tree}. On Windows that runs against Git for Windows itself. On Linux and macOS a second case puts agitshim onPATHthat answers--git-pathin drive-letter form and readsGIT_ALTERNATE_OBJECT_DIRECTORIESas one entry, the way Windows git does.scripts/lib/windows-curation.ts: oneKNOWN_WINDOWS_SAFEentry, so the Windows lane runs the new file (the detector alone excludes it forjoin(ROOT, 'bin', …)).What it deliberately does not do
cygpathconversion. Exporting a/c/…path to nativegit.exewould lean on MSYS environment rewriting, the class of bug behind Windows + Git Bash: gstack-hook-check falsely rejects all TS-entry hooks (/c/ vs C:/ join mismatch from MSYS argv translation); setup exits 1 #3088;gstack-review-logandgstack-review-readalready hand native git theC:/…form (cygpath -m).--path-format=absolute. It would remove the classification, but it changes every platform's code path and needs git 2.31+; this keeps POSIX byte-for-byte as it was.:join forGIT_ALTERNATE_OBJECT_DIRECTORIES(gstack-wtree:70,gstack-review-log:55). Windows git splits that list on;, which only matters when the caller already exported the variable; filed as found-and-left-alone below.gstack-review-log,gstack-evidence,gstack-review-reador any skill template; no regenerated files.VERSION/CHANGELOG/ README / ETHOS untouched;/shipnot run (the wave stamps the version).AI was used for assistance.
Live evidence
Isolation: a temp repo with a linked worktree, a temp
GSTACK_HOME, and the test's Git-for-Windowsgitshim first onPATH(it answers--git-pathasC:+ the real absolute path). No Windows machine here; see "Did NOT test".Before (
upstream/mainat20eb6202f):After (this branch,
ad6dd94ff):Scope
bin/gstack-wtree(+5/−3),test/gstack-wtree-windows-paths.test.ts(+88, new),scripts/lib/windows-curation.ts(+1). No VERSION, no CHANGELOG, no generated files.read-tree HEADfallback it otherwise takes prints the identical hash (the script's own comment, lines 16-22).review-log,review-start-evidence,ship-hook-windows-paths,shared-libs-source-reads,evidence,binding-template-drift,land-and-deploy-flow,ship-plan-completion-invariants,test-free-shards,windows-native-workflows,spawnsync-timeout-tripwire: 262 pass, 0 fail.bun run typecheckclean;bun run typecheck:test: "865 known diagnostics, none new".bun run testis not green on this Linux box, onupstream/maineither: Chromium cannot launch here, there is no Xvfb, and the /cso suites expect Docker and compiled scanners. The concurrent run's failures sit in 51 browse and /cso files, none of which referencesgstack-wtreeorwindows-curation. Re-running exactly those 51 files fails the same 119 tests, name for name, onupstream/main(these three files stashed) and on this branch. CI's Linux free suite is the gate.bin/gstack-redact --repo-visibility publicon the diff: no findings. slop-scan 0.3.0 onupstream/mainand on this branch: 620 findings each; the changed files carry only the pre-existingdefensive.error-obscuringatwindows-curation.ts:392, which this diff does not touch.Found and left alone: the
:-joinedGIT_ALTERNATE_OBJECT_DIRECTORIESabove (Windows splits on;);gstack-hook-check:219classifies bun's metafile inputs with/*|../*, which belongs to #3088.bun run slop:diffprints "slop-scan returned invalid JSON" here: throughspawnSyncthe 2.4 MB report comes back cut off at 219 KB, so I ran slop-scan directly on both trees instead.Liveness proof (required for external contributors)
Checklist
GSTACK PRtyped live into a real surface) or PR author is @garrytan (owner exemption)Test plan
bun test test/gstack-wtree-windows-paths.test.ts: red onupstream/main, green herebun run test: the same 119 environment failures asupstream/main, none newwindows-latestFork PRs do not get eval secrets; the free file above is the gate.
Fixes #3101