Skip to content

Keep each worktree's signatures separate - #903

Open
apiology wants to merge 1 commit into
sds:mainfrom
apiology:store-signatures-per-worktree-upstream
Open

apiology wants to merge 1 commit into
sds:mainfrom
apiology:store-signatures-per-worktree-upstream

Conversation

@apiology

Copy link
Copy Markdown
Contributor

Claude: This PR was written by Claude Code on behalf of @apiology.

Problem

Signing in one git worktree breaks commits in the others:

$ cd main && overcommit --sign
$ cd ../linked && overcommit --sign   # .overcommit.yml differs here
$ cd ../main && git commit
# Signature of configuration file has changed!
# Run `overcommit --sign` once you've verified the configuration changes.

Anyone whose worktrees carry different .overcommit.yml files or hook plugins (e.g. branches that change the config) has to re-sign on every switch.

Solution

When extensions.worktreeConfig is enabled, signatures and the recorded verify_signatures choice are read and written with git config --worktree instead of --local, so each worktree keeps its own; without the extension --worktree fails in a repo with linked worktrees (fatal: --worktree cannot be used with multiple working trees unless the config extension worktreeConfig is enabled), so behaviour there is unchanged.

Signatures live in the shared repository config, so signing in one
worktree invalidates every other worktree whose configuration or hooks
differ. When extensions.worktreeConfig is enabled, read and write them
with `git config --worktree` instead; without the extension `--worktree`
fails in a repo with linked worktrees, so `--local` remains the default.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wo4FerFK9aaxrGrmVE9ncZ
@apiology
apiology marked this pull request as ready for review October 21, 2026 20:57

This branch has not been deployed

No deployments
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