Skip to content

history: sign rewritten commits

Souma git 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 5 repliesIn review
  2. v42 patches 2 repliesSuperseded
  3. v32 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v22 patches2 repliesSuperseded

Changes in v5 from the cover letter

- Add Git completion coverage for --gpg-sign and --no-gpg-sign to the history subcommand option tests

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2replay: allow callers to sign commitsreplay.c replay.h+14 -50 replies
2/2history: sign rewritten commitsDocumentation/git-history.adoc builtin/history.c t/t3451-history-reword.sh +5 more+344 -290 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

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

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 [email protected] \
+
+ ## 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=" &&

Signature · 1 line
2.56.0