Re: [PATCH v4 09/29] rebase: support --trailer
- From
- Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
- Date
- Oct 14, 2025, 20:43 UTC
- Message-ID
- <cbe93380-e145-4ebd-a213-928b8c3ba085@app.fastmail.com>
- In-Reply-To
- <20251014122452.1851103-10-me@linux.beauty>
On Tue, Oct 14, 2025, at 14:24, Li Chen wrote:
Show 13 quoted lines
> From: Li Chen <chenl311@chinatelecom.cn> > > Implement a new `--trailer <text>` option for `git rebase` > (support merge backend only now), which appends arbitrary > trailer lines to each rebased commit message. > > Reject it if the user passes an option that requires the > apply backend (git am) since it lacks message‑filter/trailer > hook. otherwise we can just use the merge backend. > > Automatically set REBASE_FORCE when any trailer is supplied. > > And reject invalid input before user edit the interactive file.
s/edit/edits/
Show 27 quoted lines
> > Signed-off-by: Li Chen <chenl311@chinatelecom.cn> > --- > Documentation/git-rebase.adoc | 7 +++ > builtin/rebase.c | 89 +++++++++++++++++++++++++++++++++ > sequencer.c | 13 +++++ > sequencer.h | 4 +- > t/meson.build | 1 + > t/t3440-rebase-trailer.sh | 94 +++++++++++++++++++++++++++++++++++ > 6 files changed, 207 insertions(+), 1 deletion(-) > create mode 100755 t/t3440-rebase-trailer.sh > > diff --git a/Documentation/git-rebase.adoc b/Documentation/git-rebase.adoc > index 005caf6164..b2003b70d7 100644 > --- a/Documentation/git-rebase.adoc > +++ b/Documentation/git-rebase.adoc > @@ -488,6 +488,13 @@ See also INCOMPATIBLE OPTIONS below. > that if `--interactive` is given then only commits marked to be > picked, edited or reworded will have the trailer added. > + > +--trailer <trailer>:: > + Append the given trailer line(s) to every rebased commit > + message, processed via linkgit:git-interpret-trailers[1]. > + When this option is present *rebase automatically implies* > + `--force-rebase` so that fast‑forwarded commits are also > + rewritten. > +
You’ve cut off the second paragraph of `--signoff`. This should be added after `See also` below.
Probably also with an `=`:
--trailer=<trailer>::
Show 14 quoted lines
> See also INCOMPATIBLE OPTIONS below.
>
>[snip]
> +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
> +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
> +
> +. ./test-lib.sh
> +. "$TEST_DIRECTORY"/lib-rebase.sh # test_commit_message, helpers
> +
> +create_expect() {
> + cat >"$1" <<-EOF
> + $2
> +
> + Reviewed-by: Dev <dev@example.com>One level of indentation seems enough?
> + EOF > +} >[snip]
Long line.
> + git cat-file commit HEAD | grep "^Bug: 456" && > + git cat-file commit HEAD | grep -v "^Bug: 123" > +' >[snip]