Skip to content

Makefile: fix docker-check/docker-indent from a git worktree - #1184

Merged
dimitri merged 1 commit into
mainfrom
fix-citus-indent-worktree-mount
Aug 2, 2026
Merged

Makefile: fix docker-check/docker-indent from a git worktree#1184
dimitri merged 1 commit into
mainfrom
fix-citus-indent-worktree-mount

Conversation

@dimitri

@dimitri dimitri commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

make docker-check/make docker-indent (the documented way to run
citus_indent locally without installing it) failed when run from a git
worktree:

fatal: not a git repository: <main-repo>/.git/worktrees/<name>
fatal: not a git repository: <main-repo>/.git/worktrees/<name>
could not list files under source control

citus_indent calls git ls-files to find which files to check. A
worktree's own .git is just a pointer file (gitdir: <main-repo>/.git/ worktrees/<name>) to a path outside the container's mounted volume, so
that call fails inside the container.

Fix

Resolve the real common git dir on the host via git rev-parse --git-common-dir and bind-mount it into the container at the identical
absolute path, so the worktree's pointer still resolves. This is a no-op
for a plain (non-worktree) checkout, where the common dir already lives
under the mounted source tree — verified both cases work.

Also documents the make docker-check/make docker-indent shortcut in
CONTRIBUTING.md, which previously only described installing citus_indent
locally.

Verification

  • make docker-check from both a plain checkout and a git worktree
    checkout — both pass (exit 0).
  • make docker-indent — no unexpected reformatting.
  • ci/banned.h.sh — unaffected, still passes.

citus_indent calls `git ls-files` to find the files it should check.
When run from a git worktree, the worktree's own .git is only a
pointer file ("gitdir: <main-repo>/.git/worktrees/<name>") to a path
outside the mounted volume, so that call failed with "not a git
repository" / "could not list files under source control" inside the
container.

Resolve the real common git dir on the host (git rev-parse
--git-common-dir) and bind-mount it into the container at the
identical absolute path, so the worktree's pointer still resolves.
This is a no-op for a plain (non-worktree) checkout, where the common
dir already lives under the mounted source tree.

Also document the make docker-check/docker-indent shortcut in
CONTRIBUTING.md, which previously only described installing
citus_indent locally.
@dimitri
dimitri force-pushed the fix-citus-indent-worktree-mount branch from cdc44d2 to c65936f Compare August 2, 2026 15:26
@dimitri
dimitri merged commit 6257088 into main Aug 2, 2026
73 checks passed
@dimitri
dimitri deleted the fix-citus-indent-worktree-mount branch August 2, 2026 15:33
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