Skip to content

Commit

Permalink
format-patch: use the diff options for the cover letter, too
Browse files Browse the repository at this point in the history
Earlier, when you called "git format-patch --cover-letter -M", the
diffstat in the cover letter would not inherit the "-M".  Now it does.

While at it, add a few "|| break" statements in the test's loops;
otherwise, breakages inside the loops would not be caught.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Mar 2, 2008
1 parent 6dfbb30 commit 5d02294
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions builtin-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
if (!origin)
return;

diff_setup(&opts);
opts.output_format |= DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
memcpy(&opts, &rev->diffopt, sizeof(opts));
opts.output_format = DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;

diff_setup_done(&opts);

Expand Down
18 changes: 14 additions & 4 deletions t/t4014-format-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ test_expect_success 'thread' '
for i in patches/0002-* patches/0003-*
do
grep "References: $FIRST_MID" $i &&
grep "In-Reply-To: $FIRST_MID" $i
grep "In-Reply-To: $FIRST_MID" $i || break
done
'

Expand All @@ -160,7 +160,7 @@ test_expect_success 'thread in-reply-to' '
for i in patches/*
do
grep "References: $FIRST_MID" $i &&
grep "In-Reply-To: $FIRST_MID" $i
grep "In-Reply-To: $FIRST_MID" $i || break
done
'

Expand All @@ -173,7 +173,7 @@ test_expect_success 'thread cover-letter' '
for i in patches/0001-* patches/0002-* patches/0003-*
do
grep "References: $FIRST_MID" $i &&
grep "In-Reply-To: $FIRST_MID" $i
grep "In-Reply-To: $FIRST_MID" $i || break
done
'

Expand All @@ -186,7 +186,7 @@ test_expect_success 'thread cover-letter in-reply-to' '
for i in patches/*
do
grep "References: $FIRST_MID" $i &&
grep "In-Reply-To: $FIRST_MID" $i
grep "In-Reply-To: $FIRST_MID" $i || break
done
'

Expand All @@ -201,4 +201,14 @@ test_expect_success 'excessive subject' '
ls patches/0004-This-is-an-excessively-long-subject-line-for-a-messa.patch
'

test_expect_success 'cover-letter inherits diff options' '
git mv file foo &&
git commit -m foo &&
git format-patch --cover-letter -1 &&
! grep "file => foo .* 0 *$" 0000-cover-letter.patch &&
git format-patch --cover-letter -1 -M &&
grep "file => foo .* 0 *$" 0000-cover-letter.patch
'
test_done

0 comments on commit 5d02294

Please sign in to comment.