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

From: Justin Tobler <[email-masked]>
Date: Mon, 23 Feb 2026 13:41:44 -0600

Greetings,

With c20f112e51 (fast-import: add 'strip-if-invalid' mode to
--signed-commits=<mode>, 2025-11-17), it became possible to remove
invalid signatures from commits via git-fast-import(1) while maintaining
valid commits. Building upon this functionality, a user may want to
re-sign these invalid commit signatures. This series introduces the
`re-sign-if-invalid` mode to do so accordingly.

The newly added mode in this series currently ignores
`extensions.compatObjectFormat` when generating the new signatures. From
my understanding, to generate the compatability structure would also
require us to reconstruct the compatability object for the object being
signed. I think this would be possible to do, but would require getting
the mapped OIDs for the commit parents and tree. I'm not competely sure
of a good way to go about this yet though. I'm also not completely
certain if this is something that should be adressed as part of this
series, or could be done later down the road. So for now I've opted to
delay its implementation. I'm open going down the other route if that is
preferred though.

The first commit is a simple cleanup for something I noticed while
reading though commit signing code. The second commit actually
introduces the new `--signed-commits` mode.

Thanks,
-Justin

Justin Tobler (2):
  commit: remove unused forward declaration
  fast-import: add mode to re-sign invalid commit signatures

 Documentation/git-fast-import.adoc |   3 +
 builtin/fast-export.c              |   6 ++
 builtin/fast-import.c              |  43 +++++++--
 commit.h                           |   2 -
 gpg-interface.c                    |   2 +
 gpg-interface.h                    |   1 +
 t/t9305-fast-import-signatures.sh  | 142 +++++++++++++++--------------
 7 files changed, 125 insertions(+), 74 deletions(-)

base-commit: 7c02d39fc2ed2702223c7674f73150d9a7e61ba4
-- 
2.53.0