Skip to content

fix: bb format.sh re-staging inside worktrees#23711

Merged
nchamo merged 1 commit into
merge-train/fairiesfrom
nchamo/fix-bb-format-unset-git-dir
May 29, 2026
Merged

fix: bb format.sh re-staging inside worktrees#23711
nchamo merged 1 commit into
merge-train/fairiesfrom
nchamo/fix-bb-format-unset-git-dir

Conversation

@nchamo
Copy link
Copy Markdown
Contributor

@nchamo nchamo commented May 29, 2026

Problem

.git/hooks/pre-commit runs barretenberg/cpp/format.sh staged, which lists staged C++ files with git diff-index --relative --cached and re-git adds them after clang-format. Git sets GIT_DIR to an absolute path when invoking hooks; inside a worktree that makes --relative resolve against the wrong root, so the re-add runs git add on a path that is in the index but does not exist at the expected location — which stages a deletion. Committing inside a worktree therefore silently drops staged .cpp/.hpp files from the tree. Hit in practice when a merge that touched 34 barretenberg C++ files committed them away.

Fix

unset GIT_DIR near the top of format.sh, so the relative paths resolve against the worktree root. Same bug and one-liner fix as #22557 (yarn-project/precommit.sh) and #23628 (noir-projects/precommit.sh); format.sh is the last pre-commit hook script that still had it.

@nchamo nchamo added the ci-draft Run CI on draft PRs. label May 29, 2026
@nchamo nchamo self-assigned this May 29, 2026
@nchamo nchamo marked this pull request as ready for review May 29, 2026 18:24
@AztecBot
Copy link
Copy Markdown
Collaborator

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/539408366d850f2c�539408366d850f2c8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_slashing/attested_invalid_proposal.test.ts (461s) (code: 0)

@nchamo nchamo merged commit 4b26808 into merge-train/fairies May 29, 2026
37 of 45 checks passed
@nchamo nchamo deleted the nchamo/fix-bb-format-unset-git-dir branch May 29, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants