Subject: [PATCH v7 0/5] rebase: support --trailer

From: Li Chen <[email-masked]>
Date: Tue, 24 Feb 2026 15:05:46 +0800

Apologies for the long delay in sending v7.

v7 is based on origin/master at v2.53.0-154-g7c02d39fc2.

This series routes trailer insertion through an in-process path, removing the
fork/exec to builtin/interpret-trailers.

The first four commits refactor trailer rewriting in builtin/interpret-trailers
and trailer.c so callers can reuse a single in-process helper (used by git
interpret-trailers, git commit and git tag). The final commit adds git rebase
--trailer, currently supported with the merge backend only (rejecting apply-only
scenarios and validating input early).

v7:
Rebased onto origin/master at v2.53.0-154-g7c02d39fc2.
Split out a new patch to parse --trailer with OPT_STRVEC in git commit and git
tag.
Use strbuf_write() in interpret-trailers when emitting buffered output.
Restore --in-place rewriting semantics via tempfile+rename.
Drop wrapper.c/h and validate trailer args via validate_trailer_args().
Drop redundant rebase basic-state save/restore for --trailer arguments.

v6: squash all fix commits and split refactor step from the original patch
based on Phillip's suggestion and code [4].
v5: fix all Kristoffer's review comments from v4[3] in place and without new
patches.
v4: fix all reviewer comments in v3. [2], and add patch 1~8 & 10~29 to fix
review comments.
v3: merges the remaining trailer paths into one in-process helper, dropping the
duplicate code, as pointed by Junio and Phillip [1]
v2: fix issues pointed by Phillip
RFC link:
https://lore.kernel.org/git/[email-masked]/

Comments very very welcome!

[1]: https://lore.kernel.org/git/[email-masked]/
[2]: https://lore.kernel.org/git/[email-masked]/
[3]: https://lore.kernel.org/git/[email-masked]/
[4]: https://lore.kernel.org/git/[email-masked]/

Li Chen (5):
  interpret-trailers: factor trailer rewriting
  trailer: move process_trailers to trailer.h
  trailer: append trailers without fork/exec
  commit, tag: parse --trailer with OPT_STRVEC
  rebase: support --trailer

 Documentation/git-rebase.adoc |   7 ++
 builtin/commit.c              |   3 +-
 builtin/interpret-trailers.c  |  47 ++-------
 builtin/rebase.c              |  18 ++++
 builtin/tag.c                 |   4 +-
 sequencer.c                   |  28 ++++++
 sequencer.h                   |   3 +
 t/meson.build                 |   1 +
 t/t3440-rebase-trailer.sh     | 147 ++++++++++++++++++++++++++++
 trailer.c                     | 179 ++++++++++++++++++++++++++++++++--
 trailer.h                     |  30 +++++-
 11 files changed, 414 insertions(+), 53 deletions(-)
 create mode 100755 t/t3440-rebase-trailer.sh

-- 
2.52.0