Subject: Re: [PATCH v3 0/3] fast-import: add mode to re-sign invalid commit signatures

From: Justin Tobler <[email-masked]>
Date: Tue, 10 Mar 2026 17:13:34 -0500

On 26/03/10 02:20PM, Junio C Hamano wrote:
> Justin Tobler <[email-masked]> writes:
> 
> > From my perspective, "re-sign" implies that the signature was previously
> > signed, but we are now going to sign it again. Indeed, the resulting
> > commit signing is functionally the same as if the object never had a
> > previous signature though. Also, "if-invalid" already implies that the
> > object is signed, but its signature is invalid. So it could be argued
> > that "re-sign" is already redundant.
> 
> Yup.  if-invalid part indeed was why I thought "re-" was redundant.
> 
> Also, if a project is redoing its history with such a bulk
> operation, I wonder if it _still_ makes sense to tie this re-signing
> to the --signed-{tags,commits} option.  Adding signature to commits
> that were not signed is not covered well with the
> "--signed-commits=<mode>" option.

Ya, the --signed-{tags,commits} option is really only intended to
specify how already signed objects should be handled. Adding a mode to
sign unsigned objects likely wouldn't fit well. I do think this
"re-signing" mode still makes sense though since it is limited to
the subset of objects that were previously signed and the signature
invalid.

> A project may have required that all commits and tags to be signed,
> in which case "--signed-*=sign-if-invalid" would create a new
> history with everything freshly signed, but if the original history
> has signed and unsigned commits, and if they want to sign all the
> objects while rewriting their history, they may find it more handy
> if we let them do --signed-commits=strip-if-invalid --sign-commits
> i.e., drop the invalid ones and make sure all commits are signed.

This certainly seems like a reasonable use case, but if we want to
support leaving previously unsigned objects unsigned too,
`--signed-commits=strip-if-invalid --signed-commits` wouldn't be
granular enough. My thinking is that users may want such targeted object
re-signing when bulk rewriting history via tools such as
git-filter-repo. I do think that it could make sense to still add a
separate `--signed-commits` option in the future though that targets the
remaining unsigned objects.

Thanks,
-Justin