]> git.ipfire.org Git - thirdparty/git.git/commit
fast-import: add mode to sign commits with invalid signatures
authorJustin Tobler <jltobler@gmail.com>
Fri, 13 Mar 2026 01:39:38 +0000 (20:39 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Mar 2026 04:28:20 +0000 (21:28 -0700)
commitee66c793f84ef1c84ec3fe732bb26394ebefd257
treef096ae01321a350041133d3156dd39d9db27ea3a
parent86ebf870b909a7f4707aa2601d290bc992d21a53
fast-import: add mode to sign commits with invalid signatures

With git-fast-import(1), handling of signed commits is controlled via
the `--signed-commits=<mode>` option. When an invalid signature is
encountered, a user may want the option to sign the commit again as
opposed to just stripping the signature. To facilitate this, introduce a
"sign-if-invalid" mode for the `--signed-commits` option. Optionally, a
key ID may be explicitly provided in the form
`sign-if-invalid[=<keyid>]` to specify which signing key should be used
when signing invalid commit signatures.

Note that to properly support interoperability mode when signing commit
signatures, the commit buffer must be created in both the repository and
compatability object formats to generate the appropriate signatures
accordingly. As currently implemented, the commit buffer for the
compatability object format is not reconstructed and thus signing
commits in interoperability mode is not yet supported. Support may be
added in the future.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-fast-import.adoc
builtin/fast-export.c
builtin/fast-import.c
gpg-interface.c
gpg-interface.h
t/t9305-fast-import-signatures.sh