3 test_description
='diff hunk fusing'
5 TEST_PASSES_SANITIZE_LEAK
=true
21 git config
--unset diff.interHunkContext
24 4) hunks
=$4; cmd
="diff -U$3";;
25 5) hunks
=$5; cmd
="diff -U$3 --inter-hunk-context=$4";;
26 6) hunks
=$5; cmd
="diff -U$3"; git config
diff.interHunkContext
$4; use_config
="(diff.interHunkContext=$4) ";;
28 label
="$use_config$cmd, $1 common $2"
30 expected
=expected.
$file.
$3.
$hunks
36 git commit
-q -m.
$file
40 test_expect_success
"$label: count hunks ($hunks)" "
41 test $(git $cmd $file | grep '^@@ ' | wc -l) = $hunks
45 test_expect_success
"$label: check output" "
46 git $cmd $file | grep -v '^index ' >actual &&
47 test_cmp $expected actual
51 cat <<EOF >expected.f1.0.1 || exit 1
63 cat <<EOF >expected.f1.0.2 || exit 1
75 # common lines ctx intrctx hunks
97 # use diff.interHunkContext?
100 t
1 line
0 2 1 config
101 t
9 lines
3 3 1 config
102 t
2 lines
0 0 2 config
103 t
2 lines
0 1 2 config
104 t
2 lines
0 2 1 config
105 t
3 lines
1 0 2 config
106 t
3 lines
1 1 1 config
107 t
3 lines
1 2 1 config
108 t
9 lines
3 2 2 config
109 t
9 lines
3 3 1 config
111 test_expect_success
'diff.interHunkContext invalid' '
112 git config diff.interHunkContext asdf &&
113 test_must_fail git diff &&
114 git config diff.interHunkContext -1 &&
115 test_must_fail git diff