Subject: Re: [PATCH v4 09/29] rebase: support --trailer

From: "Kristoffer Haugsbakk" <[email-masked]>
Date: Tue, 14 Oct 2025 22:43:33 +0200

On Tue, Oct 14, 2025, at 14:24, Li Chen wrote:
> From: Li Chen <[email-masked]>
>
> 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/

>
> Signed-off-by: Li Chen <[email-masked]>
> ---
>  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>::

>  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 <[email-masked]>

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]