[PATCH 1/2] format-patch: use the diff options for the cover letter, too

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 builtin-log.c           |    4 ++--
 t/t4014-format-patch.sh |   18 ++++++++++++++----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index bbadbc0..fd9b3ae 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -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);
 
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 16aa99d..6d86b7d 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -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
 '
 
@@ -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
 '
 
@@ -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
 '
 
@@ -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
 '
 
@@ -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
-- 
1.5.4.3.510.g7cdd


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux