Fix "quote" misconversion for rewrite diff output.
663af3422a648e87945e4d8c0cc3e13671f2bbde (Full rework of quote_c_style and write_name_quoted.) mistakenly used puts() when writing out a fixed string when it did not want to add a terminating LF. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Nov 21, 2007 at 23:06 UTC
f8b6809d52992ad14d035bcf7c8d8cfe00ef45a0
2 files changed
+27
-1
diff.c
+1
-1
@@ -2716,7 +2716,7 @@ static void diff_summary(struct diff_filepair *p)
2716
break;
2717
default:
2718
if (p->score) {
2719
- puts(" rewrite ");
2719
+ fputs(" rewrite ", stdout);
2720
write_name_quoted(p->two->path, stdout, ' ');
2721
printf("(%d%%)\n", similarity_index(p));
2722
}
t/t4022-diff-rewrite.sh
new
+26
@@ -0,0 +1,26 @@
1
+#!/bin/sh
2
+
3
+test_description='rewrite diff'
4
+
5
+. ./test-lib.sh
6
+
7
+test_expect_success setup '
8
+
9
+ cat ../../COPYING >test &&
10
+ git add test &&
11
+ tr 'a-zA-Z' 'n-za-mN-ZA-M' <../../COPYING >test
12
+
13
+'
14
+
15
+test_expect_success 'detect rewrite' '
16
+
17
+ actual=$(git diff-files -B --summary test) &&
18
+ expr "$actual" : " rewrite test ([0-9]*%)$" || {
19
+ echo "Eh? <<$actual>>"
20
+ false
21
+ }
22
+
23
+'
24
+
25
+test_done
26
+