Skip to content

fix(bootstrap): harden cross-platform Git clone paths - #63

Merged
Zaldaryon merged 1 commit into
mainfrom
fix/issue-23-cross-platform-git-path
Aug 31, 2026
Merged

fix(bootstrap): harden cross-platform Git clone paths#63
Zaldaryon merged 1 commit into
mainfrom
fix/issue-23-cross-platform-git-path

Conversation

@Zaldaryon

Copy link
Copy Markdown
Collaborator

Problem

Issue #23 reports fatal: not in a git directory from the installer's bootstrap right after git 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-dir and --work-tree through scripts/git-repository.sh, so an inherited GIT_DIR or GIT_WORK_TREE cannot 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 plain git -C, and it never cleared GIT_DIR, GIT_WORK_TREE, or GIT_INDEX_FILE, unlike bootstrap.sh which 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 used git -C "$dest" checkout. That path is dormant today because forks.json has no reference entries, but it is one edit away from being live again.

Change

scripts/git-repository.ps1 is new: an Invoke-GitInClone helper that mirrors optimum_git_in_clone from scripts/git-repository.sh.

scripts/bootstrap.ps1 now clears GIT_DIR, GIT_WORK_TREE, and GIT_INDEX_FILE at startup and routes the compile-fork and reference-repo git calls through Invoke-GitInClone.

scripts/bootstrap.sh uses optimum_git_in_clone for the reference-repo checkout.

scripts/tests/bootstrap-git-repository.sh gains coupling assertions that fail if either script reintroduces git -C against a fresh clone, and, when pwsh is available, it runs the PowerShell helper against a real clone under an invalid GIT_DIR and checks the config and work tree land correctly.

.github/workflows/ci-bootstrap-scripts.yml is new. It runs make bootstrap-git-test on pushes and PRs that touch the bootstrap scripts. That target ran in no workflow before this.

Verification

make bootstrap-git-test passes, including the new PowerShell case. make check passes. bash -n scripts/bootstrap.sh and the PowerShell parser on both .ps1 files pass. shellcheck on the test and scripts/git-repository.sh is 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/zoomin mount is not reproducible here, so the filesystem-specific trigger stays unconfirmed. This change removes the remaining implicit-discovery paths regardless.

Addresses #23.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant