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

[PATCH v2 0/2] rebase: support --trailer

From
Li Chen <me@linux.beauty>
Date
Jun 10, 2025, 12:34 UTC
Message-ID
<20250610123459.278582-1-me@linux.beauty>
From: Li Chen <chenl311@chinatelecom.cn>

This two-patch series teaches git rebase a new --trailer <text> option and, as a prerequisite, moves all trailer handling out of the external interpret-trailers helper and into the builtin code path, as suggested by Phillip Wood.

Patch 1 switches trailer.c to an in-memory implementation (amend_strbuf_with_trailers()). It removes every fork/exec.

Patch 2 builds on that helper to implement git rebase --trailer. When the option is given we: force the merge backend (apply/am backend lacks a message filter), automatically enable --force-rebase so that fast-forwarded commits are rewritten, and append the requested trailer(s) to every rewritten commit. State is stored in $state_dir/trailer so an interrupted rebase can resume safely. A dedicated test-suite (t3440) exercises plain, conflict, --root, invalid-input scenarios and etc.

All t/*.sh testcases have run successfully. Github CI tests have all been past: https://github.com/FirstLoveLife/git/actions/runs/15558597606/job/43805117563 (except for debian built test because of network issue)

RFC link: https://lore.kernel.org/git/196a5ac1393.f5b4db7d187309.2451613571977217927@linux.beauty/

The review comments from Phillip in the RFC series have been fixed. Thanks a lot for Phillip's great review!

Comments welcome!
Li Chen (2):
  trailer: append trailers in-process and drop the fork to
    `interpret-trailers`
  rebase: support --trailer
 Documentation/git-rebase.adoc |   7 ++
 builtin/rebase.c              |  98 +++++++++++++++++++++++
 sequencer.c                   |  13 +++
 sequencer.h                   |   3 +
 t/meson.build                 |   1 +
 t/t3440-rebase-trailer.sh     |  95 ++++++++++++++++++++++
 trailer.c                     | 147 +++++++++++++++++++++++++++++++---
 trailer.h                     |  17 ++++
 8 files changed, 372 insertions(+), 9 deletions(-)
 create mode 100755 t/t3440-rebase-trailer.sh
-- 
2.49.0
Next: Li Chen
Message 1 of 7 in “rebase: support --trailer”
  1. 0/2 rebase: support --trailerLi Chen, Jun 10, 2025
  2. 1/2 trailer: append trailers in-process and drop the fork to `interpret-trailers`Li Chen, Jun 10, 2025
  3. Junio C HamanoJun 11, 2025
  4. phillip.wood123@gmail.comJun 11, 2025
  5. Junio C HamanoJun 11, 2025
  6. Li ChenJun 12, 2025
  7. 2/2 rebase: support --trailerLi Chen, Jun 10, 2025

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.