aboutsummaryrefslogtreecommitdiff
path: root/gpg-interface.h
diff options
context:
space:
mode:
authorJustin Tobler <jltobler@gmail.com>2026-03-12 20:39:38 -0500
committerJunio C Hamano <gitster@pobox.com>2026-03-12 21:28:20 -0700
commitee66c793f84ef1c84ec3fe732bb26394ebefd257 (patch)
treef096ae01321a350041133d3156dd39d9db27ea3a /gpg-interface.h
parent86ebf870b909a7f4707aa2601d290bc992d21a53 (diff)
downloadgit-ee66c793f84ef1c84ec3fe732bb26394ebefd257.tar.xz
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>
Diffstat (limited to 'gpg-interface.h')
-rw-r--r--gpg-interface.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/gpg-interface.h b/gpg-interface.h
index 37f3ac42db..a365586ce1 100644
--- a/gpg-interface.h
+++ b/gpg-interface.h
@@ -120,12 +120,15 @@ enum sign_mode {
SIGN_WARN_STRIP,
SIGN_STRIP,
SIGN_STRIP_IF_INVALID,
+ SIGN_SIGN_IF_INVALID,
};
/*
* Return 0 if `arg` can be parsed into an `enum sign_mode`. Return -1
- * otherwise.
+ * otherwise. If the parsed mode is SIGN_SIGN_IF_INVALID and GPG key provided in
+ * the arguments in the form `sign-if-invalid=<keyid>`, the key-ID is parsed
+ * into `char **keyid`.
*/
-int parse_sign_mode(const char *arg, enum sign_mode *mode);
+int parse_sign_mode(const char *arg, enum sign_mode *mode, const char **keyid);
#endif