From fd00a522ac640ead04a016c67e81555133489dae Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 28 Jul 2026 23:42:48 +0200 Subject: [PATCH] fix(hooks): move the merge-signature gate off prepare-commit-msg git commit --no-verify skips pre-commit and commit-msg, but not prepare-commit-msg. The gate sat on that stage, so the pre-commit framework ran on every commit regardless and did its stash-unstaged dance. Inside the agent sandbox its rollback (git checkout -- .) cannot unlink the bind-mounted .claude/settings.json, aborts mid-restore, and leaves every unstaged change reverted to HEAD -- twelve files of work, no commit created. The gate itself is harmless: merge_signed.sh returns 0 immediately without a MERGE_HEAD. Only the stage was wrong. On commit-msg it still runs for a normal merge commit, and --no-verify now behaves as documented. Tradeoff: a merge committed with --no-verify skips the signature check, same as it already skips make test. Co-Authored-By: Claude Opus 5 (1M context) --- .pre-commit-config.yaml | 4 ++-- Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index abbfa70575..4ff3d06c3c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- default_install_hook_types: - pre-commit - - prepare-commit-msg + - commit-msg - pre-push - post-checkout @@ -22,7 +22,7 @@ repos: pass_filenames: false always_run: true stages: - - prepare-commit-msg + - commit-msg - id: make-lint name: Run make lint (pre-push gate) entry: make lint diff --git a/Makefile b/Makefile index d83ca29877..e79e2c0b49 100644 --- a/Makefile +++ b/Makefile @@ -745,7 +745,7 @@ test-main-merged: @bash scripts/git/assert/main_merged.sh .PHONY: test-merge-signed -# Verify every commit an in-progress merge brings in (HEAD..MERGE_HEAD) is signed (prepare-commit-msg gate). +# Verify every commit an in-progress merge brings in (HEAD..MERGE_HEAD) is signed (commit-msg gate). test-merge-signed: @bash scripts/git/assert/merge_signed.sh