@matheusbsbs / matheus-bagliano / commits / 5d02294c77
Fork 0

format-patch: use the diff options for the cover letter, too

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>

Johannes Schindelin committed Mar 2, 2008 at 15:53 UTC 5d02294c776c46f0d454470c66c16fe9f08fad3d
2 files changed +16 -6
builtin-log.c
+2 -2
@@ -694,8 +694,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
694 if (!origin)
695 return;
696
697 - diff_setup(&opts);
698 - opts.output_format |= DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
697 + memcpy(&opts, &rev->diffopt, sizeof(opts));
698 + opts.output_format = DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
699
700 diff_setup_done(&opts);
701
t/t4014-format-patch.sh
+14 -4
@@ -147,7 +147,7 @@ test_expect_success 'thread' '
147 for i in patches/0002-* patches/0003-*
148 do
149 grep "References: $FIRST_MID" $i &&
150 - grep "In-Reply-To: $FIRST_MID" $i
150 + grep "In-Reply-To: $FIRST_MID" $i || break
151 done
152 '
153
@@ -160,7 +160,7 @@ test_expect_success 'thread in-reply-to' '
160 for i in patches/*
161 do
162 grep "References: $FIRST_MID" $i &&
163 - grep "In-Reply-To: $FIRST_MID" $i
163 + grep "In-Reply-To: $FIRST_MID" $i || break
164 done
165 '
166
@@ -173,7 +173,7 @@ test_expect_success 'thread cover-letter' '
173 for i in patches/0001-* patches/0002-* patches/0003-*
174 do
175 grep "References: $FIRST_MID" $i &&
176 - grep "In-Reply-To: $FIRST_MID" $i
176 + grep "In-Reply-To: $FIRST_MID" $i || break
177 done
178 '
179
@@ -186,7 +186,7 @@ test_expect_success 'thread cover-letter in-reply-to' '
186 for i in patches/*
187 do
188 grep "References: $FIRST_MID" $i &&
189 - grep "In-Reply-To: $FIRST_MID" $i
189 + grep "In-Reply-To: $FIRST_MID" $i || break
190 done
191 '
192
@@ -201,4 +201,14 @@ test_expect_success 'excessive subject' '
201 ls patches/0004-This-is-an-excessively-long-subject-line-for-a-messa.patch
202 '
203
204 +test_expect_success 'cover-letter inherits diff options' '
205 +
206 + git mv file foo &&
207 + git commit -m foo &&
208 + git format-patch --cover-letter -1 &&
209 + ! grep "file => foo .* 0 *$" 0000-cover-letter.patch &&
210 + git format-patch --cover-letter -1 -M &&
211 + grep "file => foo .* 0 *$" 0000-cover-letter.patch
212 +
213 +'
214 test_done