fix(bootstrap): harden cross-platform Git clone paths - #63
Merged
Conversation
PR #61 routed the Bash bootstrap's compile-fork clones through explicit --git-dir/--work-tree paths so an inherited GIT_DIR cannot break the post-clone config and checkout. Two implicit-discovery paths were left: - scripts/bootstrap.ps1 ran the whole clone flow with plain 'git -C' and never cleared GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE. It now clears them at startup and calls a new scripts/git-repository.ps1 helper (Invoke-GitInClone), mirroring scripts/git-repository.sh. - scripts/bootstrap.sh's reference-repo checkout still used 'git -C "$dest"'. It now uses optimum_git_in_clone. scripts/tests/bootstrap-git-repository.sh gains coupling assertions for both scripts and runs the PowerShell helper under an invalid GIT_DIR when pwsh is present. New .github/workflows/ci-bootstrap-scripts.yml runs 'make bootstrap-git-test' on changes to the bootstrap scripts. Addresses #23
This was referenced Aug 31, 2026
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
Issue #23 reports
fatal: not in a git directoryfrom the installer's bootstrap right aftergit clone, on a mounted filesystem. PR #61 fixed this for the Bash bootstrap's compile-fork clones by giving every post-clone git call an explicit--git-dirand--work-treethroughscripts/git-repository.sh, so an inheritedGIT_DIRorGIT_WORK_TREEcannot redirect discovery to the wrong repository.Two paths were still relying on implicit discovery:
The PowerShell bootstrap (
scripts/bootstrap.ps1) is a full parallel implementation of the same clone flow. It ran every clone, config, and checkout through plaingit -C, and it never clearedGIT_DIR,GIT_WORK_TREE, orGIT_INDEX_FILE, unlikebootstrap.shwhich drops them at the top. On a Windows host with any of those exported, it fails the same way #23 describes.The reference-repo checkout in
bootstrap.sh(step 3b) still usedgit -C "$dest" checkout. That path is dormant today becauseforks.jsonhas noreferenceentries, but it is one edit away from being live again.Change
scripts/git-repository.ps1is new: anInvoke-GitInClonehelper that mirrorsoptimum_git_in_clonefromscripts/git-repository.sh.scripts/bootstrap.ps1now clearsGIT_DIR,GIT_WORK_TREE, andGIT_INDEX_FILEat startup and routes the compile-fork and reference-repo git calls throughInvoke-GitInClone.scripts/bootstrap.shusesoptimum_git_in_clonefor the reference-repo checkout.scripts/tests/bootstrap-git-repository.shgains coupling assertions that fail if either script reintroducesgit -Cagainst a fresh clone, and, whenpwshis available, it runs the PowerShell helper against a real clone under an invalidGIT_DIRand checks the config and work tree land correctly..github/workflows/ci-bootstrap-scripts.ymlis new. It runsmake bootstrap-git-teston pushes and PRs that touch the bootstrap scripts. That target ran in no workflow before this.Verification
make bootstrap-git-testpasses, including the new PowerShell case.make checkpasses.bash -n scripts/bootstrap.shand the PowerShell parser on both.ps1files pass.shellcheckon the test andscripts/git-repository.shis clean.make build,make test, and the patch and compatibility gates were not re-run for this branch. The diff is limited to the bootstrap scripts, one test, and one workflow, and touches no patch, source, or C# file. The full suite passed on a refreshed tree earlier the same day.The reporter's exact
/mnt/zoominmount is not reproducible here, so the filesystem-specific trigger stays unconfirmed. This change removes the remaining implicit-discovery paths regardless.Addresses #23.