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

@nchamo nchamo commented May 29, 2026

Copy link
Copy Markdown
Contributor

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
danielntmd pushed a commit to danielntmd/aztec-packages that referenced this pull request Jun 4, 2026
BEGIN_COMMIT_OVERRIDE
docs: restore two-crate testing guidance + /errors/1 anchor (AztecProtocol#23632)
feat: txe speedup (AztecProtocol#23578)
fix(ci): don't serve cached results for disabled-cache test commands
(AztecProtocol#23658)
fix(txe): reconcile txe speedup with auth-registry/public-checks
demotion (AztecProtocol#23700)
feat(aztec-nr)!: remove set_sender_for_tags oracle, use builder pattern
for sender override (AztecProtocol#23619)
feat!: demote multi_call_entrypoint to non-protocol contract (AztecProtocol#23197)
feat(pxe): add class IDs and view context to auth request (AztecProtocol#23633)
fix: bb format.sh re-staging inside worktrees (AztecProtocol#23711)
feat!: shift remaining protocol-contract addresses to 1-3 (AztecProtocol#23218)
feat(standard-contracts): show expected-vs-actual diff in drift error
(AztecProtocol#23710)
feat(standard-contracts): add v4-style pin-build mechanism for standard
contracts (AztecProtocol#23262)
END_COMMIT_OVERRIDE
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