Re: [BUG] git commit --trailer --verbose puts trailer below scissors line
- From
Philippe Blain <levraiphilippeblain@gmail.com>
- Date
- Feb 19, 2024, 17:41 UTC
- Message-ID
- <ca6a73d3-58b4-e65c-4a8f-e6ddb3e86902@gmail.com>
- In-Reply-To
- <20240217060434.GE539459@coredump.intra.peff.net>
Hi Peff,
Le 2024-02-17 à 01:04, Jeff King a écrit :
Show 20 quoted lines
> On Fri, Feb 16, 2024 at 04:04:18PM -0500, Philippe Blain wrote: > >> Hello, >> >> I've just found a bug in the current master: running >> >> git commit --trailer="key: value" --verbose >> >> puts the trailer below the diff, and thus below the scissors >> line (and so it is discarded). >> >> I checked that it works OK in 2.42.1 but not in 2.43.2 so it is not >> a new regression in the 2.44 cycle, but I thought I'd write now in case >> someone spots the culprit commit faster than me. >> >> I'll start a bisection now. > > Looks like it bisects to 97e9d0b78a (trailer: find the end of the log > message, 2023-10-20). Here's a test that demonstrates it (signed-off-by: > me in case anyone wants to incorporate it into a fix):
Yes, this is also what I found - not without fighting a bit with 'git bisect' though, but I'll start a new thread for that.
So, it is indeed a regression in the 2.44 cycle.
Show 30 quoted lines
>
> diff --git a/t/t7502-commit-porcelain.sh b/t/t7502-commit-porcelain.sh
> index b5bf7de7cd..d8e216613f 100755
> --- a/t/t7502-commit-porcelain.sh
> +++ b/t/t7502-commit-porcelain.sh
> @@ -485,6 +485,24 @@ test_expect_success 'commit --trailer not confused by --- separator' '
> test_cmp expected actual
> '
>
> +test_expect_success 'commit --trailer with --verbose' '
> + cat >msg <<-\EOF &&
> + subject
> +
> + body
> + EOF
> + GIT_EDITOR=: git commit --edit -F msg --allow-empty \
> + --trailer="my-trailer: value" --verbose &&
> + {
> + cat msg &&
> + echo &&
> + echo "my-trailer: value"
> + } >expected &&
> + git cat-file commit HEAD >commit.msg &&
> + sed -e "1,/^\$/d" commit.msg >actual &&
> + test_cmp expected actual
> +'
> +
> test_expect_success 'multiple -m' '
>
> >negative &&Thanks for the test case!
Philippe.