Skip to content

Make tools/format.sh work from git worktrees - #404

Merged
bneradt merged 1 commit into
yahoo:masterfrom
bneradt:fix-format-in-worktrees
Oct 12, 2026
Merged

bneradt merged 1 commit into
yahoo:masterfrom
bneradt:fix-format-in-worktrees

Conversation

@bneradt

@bneradt bneradt commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Running tools/format.sh from a git worktree silently skipped
clang-format. clang-format.sh caches its downloaded binary under
/.git/fmt, but in a worktree .git is a file rather than a
directory, so creating the cache directory failed. format.sh ignored
that failure, ran the remaining formatters, and exited successfully,
which let unformatted C++ through to CI.

This patch addresses this by locating the cache under the repository's
common git directory, which is .git in a regular clone and the main
repository's .git from any worktree, so every worktree shares one
cached clang-format. format.sh now also stops with an error naming the
formatter that failed instead of reporting success.

🤖 Generated with Claude Code

Running tools/format.sh from a git worktree silently skipped
clang-format. clang-format.sh caches its downloaded binary under
<toplevel>/.git/fmt, but in a worktree .git is a file rather than a
directory, so creating the cache directory failed. format.sh ignored
that failure, ran the remaining formatters, and exited successfully,
which let unformatted C++ through to CI.

This patch addresses this by locating the cache under the repository's
common git directory, which is .git in a regular clone and the main
repository's .git from any worktree, so every worktree shares one
cached clang-format. format.sh now also stops with an error naming the
formatter that failed instead of reporting success.

Co-Authored-By: Claude Opus 5.5 (low reasoning) <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 20:39
@bneradt bneradt self-assigned this Oct 12, 2026
@bneradt bneradt added the bug Something isn't working label Oct 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bneradt
bneradt merged commit 38c912b into yahoo:master Oct 12, 2026
6 checks passed
@bneradt
bneradt deleted the fix-format-in-worktrees branch October 12, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants