3 test_description
='diff hunk fusing'
20 git config
--unset diff.interHunkContext
23 4) hunks
=$4; cmd
="diff -U$3";;
24 5) hunks
=$5; cmd
="diff -U$3 --inter-hunk-context=$4";;
25 6) hunks
=$5; cmd
="diff -U$3"; git config
diff.interHunkContext
$4; use_config
="(diff.interHunkContext=$4) ";;
27 label
="$use_config$cmd, $1 common $2"
29 expected
=expected.
$file.
$3.
$hunks
35 git commit
-q -m.
$file
39 test_expect_success
"$label: count hunks ($hunks)" "
40 test $(git $cmd $file | grep '^@@ ' | wc -l) = $hunks
44 test_expect_success
"$label: check output" "
45 git $cmd $file | grep -v '^index ' >actual &&
46 test_cmp $expected actual
50 cat <<EOF >expected.f1.0.1 || exit 1
62 cat <<EOF >expected.f1.0.2 || exit 1
74 # common lines ctx intrctx hunks
96 # use diff.interHunkContext?
100 t
9 lines
3 3 1 config
101 t
2 lines
0 0 2 config
102 t
2 lines
0 1 2 config
103 t
2 lines
0 2 1 config
104 t
3 lines
1 0 2 config
105 t
3 lines
1 1 1 config
106 t
3 lines
1 2 1 config
107 t
9 lines
3 2 2 config
108 t
9 lines
3 3 1 config
110 test_expect_success
'diff.interHunkContext invalid' '
111 git config diff.interHunkContext asdf &&
112 test_must_fail git diff &&
113 git config diff.interHunkContext -1 &&
114 test_must_fail git diff