Subject: [PATCH v6 0/4] rebase: support --trailer

From: Li Chen <[email-masked]>
Date: Wed, 5 Nov 2025 22:29:40 +0800

From: Li Chen <[email-masked]>

This series routes all trailer insertion through an in-process path, removing
the fork/exec to builtin/interpret-trailers and tempfile juggling. The first
three commits centralize logic to reduce overhead and simplify error handling.
The final commit adds git rebase --trailer, currently supported with the merge
backend only (rejecting apply-only scenarios and validating input early).

all t/*.sh testcases have run successfully.

v6: squash all fix commits and split refactor step from the original patch based on Phillip's suggestion and codes [4].
v5: fix all Kristoffer's review comments form 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 (4):
  interpret-trailers: factor out buffer-based processing to
    process_trailers()
  trailer: move process_trailers to trailer.h
  trailer: append trailers in-process and drop the fork to
    `interpret-trailers`
  rebase: support --trailer

 Documentation/git-rebase.adoc |   9 ++-
 builtin/commit.c              |   2 +-
 builtin/interpret-trailers.c  |  81 ++------------------
 builtin/rebase.c              |  50 +++++++++++++
 builtin/tag.c                 |   3 +-
 sequencer.c                   |  34 +++++++++
 sequencer.h                   |   4 +-
 t/meson.build                 |   1 +
 t/t3440-rebase-trailer.sh     | 134 ++++++++++++++++++++++++++++++++++
 trailer.c                     | 129 +++++++++++++++++++++++++++++---
 trailer.h                     |  13 +++-
 wrapper.c                     |  16 ++++
 wrapper.h                     |   6 ++
 13 files changed, 392 insertions(+), 90 deletions(-)
 create mode 100755 t/t3440-rebase-trailer.sh

-- 
2.51.0