Skip to content

Keep each worktree's signatures separate - #903

Merged
sds merged 2 commits into
sds:mainfrom
apiology:store-signatures-per-worktree-upstream
Oct 31, 2026
Merged

sds merged 2 commits 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
@sds
sds merged commit 05a8836 into sds:main Oct 31, 2026
10 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants