Skip to content

Commit 8d5c5a0

Browse files
committed
Merge branch 'jk/commit-use-no-divider-with-interpret-trailers'
When "git commit --trailer=..." invokes the interpret-trailers machinery, it knows what it feeds to interpret-trailers is a full log message without any patch, but failed to express that by passing the "--no-divider" option, which has been corrected. * jk/commit-use-no-divider-with-interpret-trailers: commit: pass --no-divider to interpret-trailers
2 parents 94486b6 + be3d654 commit 8d5c5a0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

builtin/commit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
10431043
struct child_process run_trailer = CHILD_PROCESS_INIT;
10441044

10451045
strvec_pushl(&run_trailer.args, "interpret-trailers",
1046-
"--in-place", git_path_commit_editmsg(), NULL);
1046+
"--in-place", "--no-divider",
1047+
git_path_commit_editmsg(), NULL);
10471048
strvec_pushv(&run_trailer.args, trailer_args.v);
10481049
run_trailer.git_cmd = 1;
10491050
if (run_command(&run_trailer))

t/t7502-commit-porcelain.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,25 @@ test_expect_success 'commit --trailer with -c and command' '
466466
test_cmp expected actual
467467
'
468468

469+
test_expect_success 'commit --trailer not confused by --- separator' '
470+
cat >msg <<-\EOF &&
471+
subject
472+
473+
body with dashes
474+
---
475+
in it
476+
EOF
477+
git commit --allow-empty --trailer="my-trailer: value" -F msg &&
478+
{
479+
cat msg &&
480+
echo &&
481+
echo "my-trailer: value"
482+
} >expected &&
483+
git cat-file commit HEAD >commit.msg &&
484+
sed -e "1,/^\$/d" commit.msg >actual &&
485+
test_cmp expected actual
486+
'
487+
469488
test_expect_success 'multiple -m' '
470489
471490
>negative &&

0 commit comments

Comments
 (0)