]> git.ipfire.org Git - thirdparty/git.git/commit
fast-import: add '--signed-commits=<mode>' option
authorChristian Couder <christian.couder@gmail.com>
Wed, 17 Sep 2025 18:14:27 +0000 (20:14 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Sep 2025 18:18:28 +0000 (11:18 -0700)
commiteaaddf57912466414bce5bf81a24d1d69caf2e51
tree3e2a42aaa7d1045088a95a458ee13eae13ef63ab
parent2f8fd208c36bf2e88f949d0c4059214dfcb2a717
fast-import: add '--signed-commits=<mode>' option

A '--signed-commits=<mode>' option is already available when using
`git fast-export` to decide what should be done at export time about
commit signatures. At import time though, there is no option, or
other way, in `git fast-import` to decide about commit signatures.

To remediate that, let's add a '--signed-commits=<mode>' option to
`git fast-import` too.

For now the supported <mode>s are the same as those supported by
`git fast-export`.

The code responsible for consuming a signature is refactored into
the import_one_signature() and discard_one_signature() functions,
which makes it easier to follow the logic and add new modes in the
future.

In the 'strip' and 'warn-strip' modes, we deliberately use
discard_one_signature() to discard the signature without parsing it.
This ensures that even malformed signatures, which would cause the
parser to fail, can be successfully stripped from a commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-fast-import.adoc
builtin/fast-import.c
t/meson.build
t/t9305-fast-import-signatures.sh [new file with mode: 0755]