You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
make setup and pre-push hook fail with 'this operation must be run in a work tree' in linked git worktrees #10293
After merging current main (head ~5b74e63582 era, which touched make setup / hook installation — scripts/test-make-setup.sh landed recently), both make setup and the installed pre-push hook fail inside a linked worktree (git worktree add ...):
$ git push origin <branch>
fatal: this operation must be run in a work tree
error: failed to push some refs to 'https://github.com/BasedHardware/omi.git'
$ make setup
fatal: this operation must be run in a work tree
make: *** [setup-hooks] Error 128
Same commands work in the primary checkout. AGENTS.md documents worktrees as the default workflow ("Always work in a git worktree for code changes") and says hooks are installed "with linked-worktree-safe paths", so this looks like a regression in the new setup/hook scripts — likely a git invocation that resolves --git-dir to the shared common dir and then requires a work tree.
Workaround used: ran the full make preflight manifest manually (green) and pushed with --no-verify.
The full-chain fix from #10491 is now preserved in #10574, including Nik Shevchenko's co-author credit. I adapted its regression to the PR's explicit Windows Python launcher contract and registered it in both manifest lanes plus the native Windows workflow.
Current main still lacked the five downstream root fallbacks after the Makefile/dispatcher fix: scripts/pre-push, scripts/pre-push-singleflight, scripts/pr-preflight, .github/scripts/preflight_runner.py, and .github/scripts/pr_preflight.py. On the refreshed #10574 head (a0a4622002), the native Windows linked-worktree regression passes across all five entrypoints, and the three-check Windows manifest run is green.
Both reported symptoms (make setup → setup-hooks Error 128 and git push → pre-push hook "this operation must be run in a work tree" in a linked worktree) are fixed at HEAD by merged PR #10401 — fix(setup): resolve repo root without a work tree in linked worktrees (merged 2026-07-23, an ancestor of current HEAD).
Verifiable at HEAD:
Makefile:1 — HOOKS_DIR := $(shell git rev-parse --git-path hooks). --git-path resolves the hook dir without requiring a work tree, so it never exits 128 in a linked-worktree git-dir context.
Makefile:9 — PYTHON ?= $(shell bash -c 'source "$$(git rev-parse --show-toplevel 2>/dev/null || pwd)/scripts/dev-harness/_resolve_python.sh"; dev_harness_python'). The || pwd fallback is exactly the linked-worktree repair (previously an empty prefix turned every target into /scripts/dev-harness/_resolve_python.sh: No such file).
scripts/install-git-hooks.sh (the setup-hooks installer and the runtime hook dispatcher) resolves ROOT from the script's own path rather than show-toplevel, and uses --git-path hooks. The installed pre-push dispatcher falls back: ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" (Git runs hooks with cwd at the worktree top, so this resolves).
scripts/test-make-setup.sh:103-141 is a regression test that reproduces the bare-GIT_DIR condition (show-toplevel exits 128 while --git-path hooks still resolves) and asserts the Makefile root no longer collapses.
The still-open #10574 is a separate follow-up — Windows Python-launcher portability hardening that adds fallbacks to the downstream pre-push/pre-push-singleflight/pr-preflight/preflight_runner.py/pr_preflight.py entrypoints. It is not required for the macOS/Linux linked-worktree regression reported here: in the normal hook-execution context Git sets cwd to the worktree top, so those scripts' git rev-parse --show-toplevel already resolves. Closing on the merged, HEAD-present fix (#10401).
Activity
fix(setup): restore linked-worktree root fallback
tianmind-studio commentedon Jul 27, 2026
The full-chain fix from #10491 is now preserved in #10574, including Nik Shevchenko's co-author credit. I adapted its regression to the PR's explicit Windows Python launcher contract and registered it in both manifest lanes plus the native Windows workflow.
Current
mainstill lacked the five downstream root fallbacks after the Makefile/dispatcher fix:scripts/pre-push,scripts/pre-push-singleflight,scripts/pr-preflight,.github/scripts/preflight_runner.py, and.github/scripts/pr_preflight.py. On the refreshed #10574 head (a0a4622002), the native Windows linked-worktree regression passes across all five entrypoints, and the three-check Windows manifest run is green.fix(setup): restore linked-worktree root fallback
Git-on-my-level commentedon Jul 29, 2026
Both reported symptoms (
make setup→setup-hooksError 128 andgit push→ pre-push hook "this operation must be run in a work tree" in a linked worktree) are fixed at HEAD by merged PR #10401 — fix(setup): resolve repo root without a work tree in linked worktrees (merged 2026-07-23, an ancestor of current HEAD).Verifiable at HEAD:
Makefile:1—HOOKS_DIR := $(shell git rev-parse --git-path hooks).--git-pathresolves the hook dir without requiring a work tree, so it never exits 128 in a linked-worktree git-dir context.Makefile:9—PYTHON ?= $(shell bash -c 'source "$$(git rev-parse --show-toplevel 2>/dev/null || pwd)/scripts/dev-harness/_resolve_python.sh"; dev_harness_python'). The|| pwdfallback is exactly the linked-worktree repair (previously an empty prefix turned every target into/scripts/dev-harness/_resolve_python.sh: No such file).scripts/install-git-hooks.sh(thesetup-hooksinstaller and the runtime hook dispatcher) resolvesROOTfrom the script's own path rather thanshow-toplevel, and uses--git-path hooks. The installed pre-push dispatcher falls back:ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"(Git runs hooks with cwd at the worktree top, so this resolves).scripts/test-make-setup.sh:103-141is a regression test that reproduces the bare-GIT_DIRcondition (show-toplevelexits 128 while--git-path hooksstill resolves) and asserts the Makefile root no longer collapses.The still-open #10574 is a separate follow-up — Windows Python-launcher portability hardening that adds fallbacks to the downstream
pre-push/pre-push-singleflight/pr-preflight/preflight_runner.py/pr_preflight.pyentrypoints. It is not required for the macOS/Linux linked-worktree regression reported here: in the normal hook-execution context Git sets cwd to the worktree top, so those scripts'git rev-parse --show-toplevelalready resolves. Closing on the merged, HEAD-present fix (#10401).fix(ci): make pre-push portable on Windows (#10574)