Raw
1 #!/bin/sh
2
3 test_description='diff hunk header truncation'
4
5 . ./test-lib.sh
6
7 N='日本語'
8 N1='日'
9 N2='日本'
10 NS="$N$N$N$N$N$N$N$N$N$N$N$N$N"
11
12 test_expect_success setup '
13
14 (
15 echo "A $NS" &&
16 printf " %s\n" B C D E F G H I J K &&
17 echo "L $NS" &&
18 printf " %s\n" M N O P Q R S T U V
19 ) >file &&
20 git add file &&
21
22 sed -e "/^ [EP]/s/$/ modified/" <file >file+ &&
23 mv file+ file
24
25 '
26
27 test_expect_success 'hunk header truncation with an overly long line' '
28
29 git diff | sed -n -e "s/^.*@@//p" >actual &&
30 (
31 echo " A $N$N$N$N$N$N$N$N$N2" &&
32 echo " L $N$N$N$N$N$N$N$N$N1"
33 ) >expected &&
34 test_cmp expected actual
35
36 '
37
38 test_done