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

[PATCH v5 0/2] history: sign rewritten commits

From
SSouma <git@5ouma.me>
Date
Oct 3, 2026, 13:40 UTC
Message-ID
<20261003134058.23494-1-git@5ouma.me>
In-Reply-To
<20260703145037.69832-1-git@5ouma.me>

History rewriting creates commits through two paths: the history commands write replacement commits directly, while the replay machinery recreates descendants above the rewritten range. Neither path currently honors `commit.gpgSign` or an explicit signing request, so rewriting signed history can leave the resulting commits unsigned.

Add a signing-key option to the replay API, then have the history commands pass the selected signer through both paths. Expose the standard `-S`/`--gpg-sign[=<key-id>]` and `--no-gpg-sign` options for `drop`, `fixup`, `reword`, `split`, and `squash`. This applies one signing policy to every commit created by the rewrite, including both commits from `split`, the commit from `squash`, and replayed descendants.

The behavior follows rebase, cherry-pick, and revert: `commit.gpgSign` supplies the default, command-line options override it, and the last command-line option wins. The signature attests the current committer's rewrite while preserving the original author identity.

Changes since v4:
 - Add Git completion coverage for `--gpg-sign` and `--no-gpg-sign` to the
   history subcommand option tests
Souma (2):
  replay: allow callers to sign commits
  history: sign rewritten commits
 Documentation/git-history.adoc | 18 +++++--
 builtin/history.c              | 96 +++++++++++++++++++++++++---------
 replay.c                       | 13 +++--
 replay.h                       |  6 +++
 t/t3451-history-reword.sh      | 63 ++++++++++++++++++++++
 t/t3452-history-split.sh       | 44 ++++++++++++++++
 t/t3453-history-fixup.sh       | 39 ++++++++++++++
 t/t3454-history-drop.sh        | 50 ++++++++++++++++++
 t/t3455-history-squash.sh      | 61 +++++++++++++++++++++
 t/t9902-completion.sh          |  2 +
 10 files changed, 358 insertions(+), 34 deletions(-)
Range-diff against v4:
1:  d45cce8e25 = 1:  d45cce8e25 replay: allow callers to sign commits
2:  8b4766fc0e ! 2:  65f3de1562 history: sign rewritten commits
    @@ t/t3455-history-squash.sh: check_commit_author () {
      test_expect_success 'setup linear history touching two files' '
      	test_commit base file a start &&
      	GIT_AUTHOR_NAME=One GIT_AUTHOR_EMAIL=one@example.com \
    +
    + ## t/t9902-completion.sh ##
    +@@ t/t9902-completion.sh: test_expect_success 'git history subcommand options' '
    + 	test_completion "git history split main --" <<-\EOF &&
    + 	--update-refs=Z
    + 	--dry-run Z
    ++	--gpg-sign Z
    ++	--no-... Z
    + 	--no-dry-run Z
    + 	EOF
    + 	test_completion "git history fixup --upd" "--update-refs=" &&
-- 
2.56.0
Previous: SoumaNext: Junio C Hamano
Message 25 of 30 in “history: sign rewritten commits”
  1. 0/3 history: sign rewritten commitsSouma, Jul 3, 2026
  2. 1/3 builtin/history: sign rewritten commitsSouma, Jul 3, 2026
  3. Patrick SteinhardtJul 16, 2026
  4. 2/3 doc: document history signing optionsSouma, Jul 3, 2026
  5. Patrick SteinhardtJul 16, 2026
  6. 3/3 t345x: cover signed history rewritesSouma, Jul 3, 2026
  7. 0/2 history: support signing rewritten commitsSouma, Jul 17, 2026
  8. 1/2 replay: allow callers to sign commitsSouma, Jul 17, 2026
  9. Patrick SteinhardtSep 11, 2026
  10. 2/2 builtin/history: sign rewritten commitsSouma, Jul 17, 2026
  11. Patrick SteinhardtSep 11, 2026
  12. 0/2 history: support signing rewritten commitsSouma, Sep 12, 2026
  13. 1/2 replay: allow callers to sign commitsSouma, Sep 12, 2026
  14. Patrick SteinhardtSep 28, 2026
  15. 2/2 history: sign rewritten commitsSouma, Sep 12, 2026
  16. Patrick SteinhardtSep 28, 2026
  17. Junio C HamanoSep 28, 2026
  18. Junio C HamanoSep 28, 2026
  19. SoumaSep 28, 2026
  20. 0/2 history: sign rewritten commitsSouma, Oct 2, 2026
  21. Junio C HamanoOct 2, 2026
  22. SoumaOct 3, 2026
  23. 1/2 replay: allow callers to sign commitsSouma, Oct 2, 2026
  24. 2/2 history: sign rewritten commitsSouma, Oct 2, 2026
  25. 0/2 history: sign rewritten commitsSouma, Oct 3, 2026
  26. Junio C HamanoOct 4, 2026
  27. SoumaOct 5, 2026
  28. Junio C HamanoOct 6, 2026
  29. 1/2 replay: allow callers to sign commitsSouma, Oct 3, 2026
  30. 2/2 history: sign rewritten commitsSouma, Oct 3, 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.