Fix repo-root guard to work inside a git worktree#39
Conversation
setup.sh, pgxntool-sync.sh, and update-setup-files.sh guarded the project root with `[ -d .git ]`. In a linked git worktree `.git` is a file, not a directory, so the guard failed: setup.sh wrongly re-ran `git init`, and the sync scripts aborted with "Not in a git repository." on a perfectly valid working tree. They now detect the repo with `git rev-parse --git-dir`, which works in both a normal clone and a worktree. Fixes Postgres-Extensions#38. Related changes in pgxntool-test: - Add a regression test running update-setup-files.sh inside a git worktree Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe setup, synchronization, and setup-file update scripts now detect Git repositories with Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
c7928af
into
Postgres-Extensions:master
…24) Related pgxntool PR: Postgres-Extensions/pgxntool#39 Covers the pgxntool fix for the `.git`-in-a-worktree guard (issue #38). - **New regression test** (`update-setup-files.bats`): runs `update-setup-files.sh` from inside a linked git worktree (where `.git` is a file) and confirms it gets past the repo-root guard instead of dying with "Not in a git repository." - **Fix flaky wiring test** (`pgxntool-sync.bats`): the sync-target test matched all of `make -n` output, which failed under `make test-all` because the nested make prints "Entering/Leaving directory" bookkeeping. It now greps the `pgxntool-sync.sh` recipe line and matches that exactly — still pins the full command, but ignores make's chatter. Full suite green (212/212) on PG 17. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes #38.
setup.sh,pgxntool-sync.sh, andupdate-setup-files.shguarded the project root with[ -d .git ]. In a linked git worktree (git worktree add),.gitis a file (agitdir:pointer), not a directory, so the guard failed on a perfectly valid working tree:setup.shwrongly re-rangit initERROR: Not in a git repository.All three now detect the repo with
git rev-parse --git-dir, which works in both a normal clone and a worktree.Verification
Related pgxntool-test PR: Postgres-Extensions/pgxntool-test#24
🤖 Generated with Claude Code