Junio C Hamano | 2370781 | 2008-01-02 01:50:11 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='diff hunk header truncation' |
| 4 | |
Ævar Arnfjörð Bjarmason | 7ff2478 | 2021-10-12 15:56:45 +0200 | [diff] [blame] | 5 | TEST_PASSES_SANITIZE_LEAK=true |
Junio C Hamano | 2370781 | 2008-01-02 01:50:11 -0800 | [diff] [blame] | 6 | . ./test-lib.sh |
| 7 | |
| 8 | N='日本語' |
| 9 | N1='日' |
| 10 | N2='日本' |
| 11 | NS="$N$N$N$N$N$N$N$N$N$N$N$N$N" |
| 12 | |
| 13 | test_expect_success setup ' |
| 14 | |
| 15 | ( |
Eric Sunshine | f957f03 | 2018-07-01 20:24:00 -0400 | [diff] [blame] | 16 | echo "A $NS" && |
Eric Sunshine | efe26b9 | 2021-12-09 00:11:11 -0500 | [diff] [blame] | 17 | printf " %s\n" B C D E F G H I J K && |
Eric Sunshine | f957f03 | 2018-07-01 20:24:00 -0400 | [diff] [blame] | 18 | echo "L $NS" && |
Eric Sunshine | efe26b9 | 2021-12-09 00:11:11 -0500 | [diff] [blame] | 19 | printf " %s\n" M N O P Q R S T U V |
Junio C Hamano | 2370781 | 2008-01-02 01:50:11 -0800 | [diff] [blame] | 20 | ) >file && |
| 21 | git add file && |
| 22 | |
| 23 | sed -e "/^ [EP]/s/$/ modified/" <file >file+ && |
| 24 | mv file+ file |
| 25 | |
| 26 | ' |
| 27 | |
| 28 | test_expect_success 'hunk header truncation with an overly long line' ' |
| 29 | |
| 30 | git diff | sed -n -e "s/^.*@@//p" >actual && |
| 31 | ( |
Eric Sunshine | f957f03 | 2018-07-01 20:24:00 -0400 | [diff] [blame] | 32 | echo " A $N$N$N$N$N$N$N$N$N2" && |
Junio C Hamano | 2370781 | 2008-01-02 01:50:11 -0800 | [diff] [blame] | 33 | echo " L $N$N$N$N$N$N$N$N$N1" |
| 34 | ) >expected && |
Matthew DeVore | dcbaa0b | 2018-10-05 14:54:04 -0700 | [diff] [blame] | 35 | test_cmp expected actual |
Junio C Hamano | 2370781 | 2008-01-02 01:50:11 -0800 | [diff] [blame] | 36 | |
| 37 | ' |
| 38 | |
| 39 | test_done |