update-setup-files.sh (and pgxntool-sync.sh) guard on the project root being a git repo with:
[[ -d ".git" ]] || die 1 "Not in a git repository."
In a git worktree (git worktree add), .git is a file (a gitdir: pointer), not a directory, so the check fails and the script aborts with "Not in a git repository." — even though it's a perfectly valid working tree. All the actual git operations the scripts use (git show, git merge-file, git add, etc.) work fine in a worktree; only this guard is too strict.
Repro
git worktree add ../wt-test HEAD
cd ../wt-test
pgxntool/update-setup-files.sh <old-commit> # -> ERROR: Not in a git repository.
Suggested fix
Detect the repo with a worktree-safe check instead of [ -d .git ], e.g.:
git rev-parse --git-dir >/dev/null 2>&1 || die 1 "Not in a git repository."
Same guard appears in setup.sh ([ -d .git ] || git init), which would also misbehave in a worktree.
update-setup-files.sh(andpgxntool-sync.sh) guard on the project root being a git repo with:In a git worktree (
git worktree add),.gitis a file (agitdir:pointer), not a directory, so the check fails and the script aborts with "Not in a git repository." — even though it's a perfectly valid working tree. All the actual git operations the scripts use (git show,git merge-file,git add, etc.) work fine in a worktree; only this guard is too strict.Repro
Suggested fix
Detect the repo with a worktree-safe check instead of
[ -d .git ], e.g.:Same guard appears in
setup.sh([ -d .git ] || git init), which would also misbehave in a worktree.