blob: 5397cb7d42d748054eb5a244415c2f5062e3eca2 [file] [log] [blame]
Junio C Hamano23707812008-01-02 01:50:11 -08001#!/bin/sh
2
3test_description='diff hunk header truncation'
4
Ævar Arnfjörð Bjarmason7ff24782021-10-12 15:56:45 +02005TEST_PASSES_SANITIZE_LEAK=true
Junio C Hamano23707812008-01-02 01:50:11 -08006. ./test-lib.sh
7
8N='日本語'
9N1='日'
10N2='日本'
11NS="$N$N$N$N$N$N$N$N$N$N$N$N$N"
12
13test_expect_success setup '
14
15 (
Eric Sunshinef957f032018-07-01 20:24:00 -040016 echo "A $NS" &&
Eric Sunshineefe26b92021-12-09 00:11:11 -050017 printf " %s\n" B C D E F G H I J K &&
Eric Sunshinef957f032018-07-01 20:24:00 -040018 echo "L $NS" &&
Eric Sunshineefe26b92021-12-09 00:11:11 -050019 printf " %s\n" M N O P Q R S T U V
Junio C Hamano23707812008-01-02 01:50:11 -080020 ) >file &&
21 git add file &&
22
23 sed -e "/^ [EP]/s/$/ modified/" <file >file+ &&
24 mv file+ file
25
26'
27
28test_expect_success 'hunk header truncation with an overly long line' '
29
30 git diff | sed -n -e "s/^.*@@//p" >actual &&
31 (
Eric Sunshinef957f032018-07-01 20:24:00 -040032 echo " A $N$N$N$N$N$N$N$N$N2" &&
Junio C Hamano23707812008-01-02 01:50:11 -080033 echo " L $N$N$N$N$N$N$N$N$N1"
34 ) >expected &&
Matthew DeVoredcbaa0b2018-10-05 14:54:04 -070035 test_cmp expected actual
Junio C Hamano23707812008-01-02 01:50:11 -080036
37'
38
39test_done