git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Feb 24, 2026, 22:41 UTC
Message-ID
<aZ4pFUJApZosh9Gc@fruit.crustytoothpaste.net>
In-Reply-To
<20260223194146.3476768-1-jltobler@gmail.com>
On 2026-02-23 at 19:41:44, Justin Tobler wrote:
Show 20 quoted lines
> 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.

There's an API for converting object IDs to another algorithm: `repo_oid_to_algop`. If you want to convert a non-blob object, there's `convert_object_file`, which will serialize the object in the other format (blobs are invariant in the hash algorithm transformation, so converting them is not necessary). Those are present right now in the codebase and using them would be a good idea.

If you want to test your code in interoperability mode, you can rebase onto the `sha256-interop` branch of https://github.com/bk2204/git.git and run with `GIT_TEST_DEFAULT_HASH=sha256:sha1`.

If you're _not_ going to implement that in interoperability mode, then I'd rather you just die in that case so that the test fails and then I or someone else will fix it. `extensions.compatObjectFormat` is presently experimental and the data formats will change, so nobody should be relying on it working as it stands right now. There _will_ be more compatibility breakage coming in future series, for instance.

I _would_ recommend regardless that you add a test like in t7004's "signed tag with embedded PGP message" if you apply this to tags as well as commits. That requires a special case in our interoperability code (since it normally converts things that look like signatures, but when we're _generating_ a tag, we don't want to do that since there are no signatures yet) and making sure we do the same thing in fast-import will avoid corruption in our conversions.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Christian CouderNext: Junio C Hamano
Message 8 of 60 in “fast-import: add mode to re-sign invalid commit signatures”
  1. 0/2 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Feb 23, 2026
  2. 1/2 commit: remove unused forward declarationJustin Tobler, Feb 23, 2026
  3. Patrick SteinhardtFeb 24, 2026
  4. 2/2 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Feb 23, 2026
  5. Patrick SteinhardtFeb 24, 2026
  6. Justin ToblerFeb 24, 2026
  7. Christian CouderFeb 24, 2026
  8. brian m. carlsonFeb 24, 2026
  9. Junio C HamanoFeb 24, 2026
  10. Justin ToblerMar 2, 2026
  11. 0/3 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Mar 6, 2026
  12. 1/3 commit: remove unused forward declarationJustin Tobler, Mar 6, 2026
  13. 2/3 gpg-interface: introduce sign_buffer_with_key()Justin Tobler, Mar 6, 2026
  14. Christian CouderMar 10, 2026
  15. Justin ToblerMar 10, 2026
  16. 3/3 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Mar 6, 2026
  17. Christian CouderMar 10, 2026
  18. Justin ToblerMar 10, 2026
  19. 0/3 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Mar 10, 2026
  20. 1/3 commit: remove unused forward declarationJustin Tobler, Mar 10, 2026
  21. Junio C HamanoMar 10, 2026
  22. 2/3 gpg-interface: introduce sign_buffer_with_key()Justin Tobler, Mar 10, 2026
  23. Junio C HamanoMar 10, 2026
  24. 3/3 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Mar 10, 2026
  25. Junio C HamanoMar 10, 2026
  26. Justin ToblerMar 10, 2026
  27. Junio C HamanoMar 10, 2026
  28. Justin ToblerMar 10, 2026
  29. Junio C HamanoMar 10, 2026
  30. Justin ToblerMar 10, 2026
  31. 0/3 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Mar 11, 2026
  32. 1/3 commit: remove unused forward declarationJustin Tobler, Mar 11, 2026
  33. 2/3 gpg-interface: introduce sign_buffer_with_key()Justin Tobler, Mar 11, 2026
  34. Patrick SteinhardtMar 12, 2026
  35. Justin ToblerMar 12, 2026
  36. 3/3 fast-import: add mode to sign commits with invalid signaturesJustin Tobler, Mar 11, 2026
  37. Patrick SteinhardtMar 12, 2026
  38. Justin ToblerMar 12, 2026
  39. Patrick SteinhardtMar 12, 2026
  40. Justin ToblerMar 12, 2026
  41. 0/3 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Mar 12, 2026
  42. 1/3 commit: remove unused forward declarationJustin Tobler, Mar 12, 2026
  43. 2/3 gpg-interface: allow sign_buffer() to use default signing keyJustin Tobler, Mar 12, 2026
  44. Junio C HamanoMar 12, 2026
  45. Justin ToblerMar 12, 2026
  46. 3/3 fast-import: add mode to sign commits with invalid signaturesJustin Tobler, Mar 12, 2026
  47. Junio C HamanoMar 12, 2026
  48. Justin ToblerMar 12, 2026
  49. Jeff KingMar 12, 2026
  50. Justin ToblerMar 13, 2026
  51. Junio C HamanoMar 12, 2026
  52. Justin ToblerMar 12, 2026
  53. 0/3 fast-import: add mode to re-sign invalid commit signaturesJustin Tobler, Mar 13, 2026
  54. 1/3 commit: remove unused forward declarationJustin Tobler, Mar 13, 2026
  55. 2/3 gpg-interface: allow sign_buffer() to use default signing keyJustin Tobler, Mar 13, 2026
  56. Patrick SteinhardtMar 13, 2026
  57. 3/3 fast-import: add mode to sign commits with invalid signaturesJustin Tobler, Mar 13, 2026
  58. Patrick SteinhardtMar 13, 2026
  59. Junio C HamanoMar 13, 2026
  60. Patrick SteinhardtMar 13, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.