Subject: Re: [PATCH v4 25/29] tests: t3440: test --trailer without values

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

On Tue, Oct 14, 2025, at 14:24, Li Chen wrote:
> Added a regression test to ensure git
> rebase --trailer accepts trailers without
> values while preserving the separator’s
> trailing space in the recorded message.

See “imperative-mood” in `Documentation/SubmittingPatches`.
Something like:

    Add a regression test to ensure

>
> Signed-off-by: Li Chen <[email-masked]>
> ---
>  t/t3440-rebase-trailer.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/t/t3440-rebase-trailer.sh b/t/t3440-rebase-trailer.sh
> index 36f11f579e..df121efd0e 100755
> --- a/t/t3440-rebase-trailer.sh
> +++ b/t/t3440-rebase-trailer.sh
> @@ -50,6 +50,16 @@ test_expect_success 'reject trailer with missing key
> before separator' '
>  	test_grep "missing key before separator" err
>  '
>
> +test_expect_success 'allow trailer with missing value after separator'
> '
> +	git rebase -m --trailer "Acked-by:" HEAD~1 third &&
> +	cat >expect <<-\EOF &&
> +	third
> +
> +	Acked-by:

This adds a trailing space to the source which will make
`ci/check-whitespace.sh` fail.  I think you are supposed to do something
similar to what is done in `t/t4124-apply-ws-rule.sh`.  Namely to use
some placeholder character like `_`:

    Acked-by:_

Together with:

    sed -e "s/_/ /g"

I could also imagine that a variable like `${SP}` might have worked
together with `-EOF` similar to single quote:

   t/test-lib.sh:SQ=\'

But `t/test-lib.sh` does not seem to have that.  (Although it does have
`LF` (line feed)).

> +	EOF
>[snip]