diff options
| author | Justin Tobler <jltobler@gmail.com> | 2026-03-26 14:14:14 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-26 12:42:58 -0700 |
| commit | ddd7c7ab12a25850e96f550567ef06fb9bea0cc0 (patch) | |
| tree | ffddebd4f66f90f80569eab998212d3895fa7378 /builtin | |
| parent | 2b1546c03cc3e02e51261fa38fe47a4f1b4e295b (diff) | |
| download | git-ddd7c7ab12a25850e96f550567ef06fb9bea0cc0.tar.xz | |
fast-import: add 'abort-if-invalid' mode to '--signed-tags=<mode>'
In git-fast-import(1), the 'abort-if-invalid' mode for the
'--signed-commits' option verifies commit signatures during import and
aborts the entire operation when verification fails. Extend the same
behavior to signed tag objects by introducing an 'abort-if-invalid' mode
for the '--signed-tags' option.
Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/fast-import.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 783e0e7ab4..cd1181023d 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -3109,6 +3109,9 @@ static void handle_tag_signature_if_invalid(struct strbuf *buf, if (!check_signature(&sigc, signature.buf, signature.len)) goto out; + if (signed_tag_mode == SIGN_ABORT_IF_INVALID) + die(_("aborting due to invalid signature")); + strbuf_setlen(msg, sig_offset); if (signed_tag_mode == SIGN_SIGN_IF_INVALID) { @@ -3156,6 +3159,7 @@ static void handle_tag_signature(struct strbuf *buf, struct strbuf *msg, const c /* Truncate the buffer to remove the signature */ strbuf_setlen(msg, sig_offset); break; + case SIGN_ABORT_IF_INVALID: case SIGN_SIGN_IF_INVALID: case SIGN_STRIP_IF_INVALID: handle_tag_signature_if_invalid(buf, msg, sig_offset); @@ -3165,9 +3169,6 @@ static void handle_tag_signature(struct strbuf *buf, struct strbuf *msg, const c case SIGN_ABORT: die(_("encountered signed tag; use " "--signed-tags=<mode> to handle it")); - case SIGN_ABORT_IF_INVALID: - die(_("'abort-if-invalid' is not a valid mode for " - "git fast-import with --signed-tags=<mode>")); default: BUG("invalid signed_tag_mode value %d from tag '%s'", signed_tag_mode, name); |
