3 test_description
='git am with options and not losing them'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 tm
="$TEST_DIRECTORY/t4252"
10 test_expect_success setup
'
11 cp "$tm/file-1-0" file-1 &&
12 cp "$tm/file-2-0" file-2 &&
13 git add file-1 file-2 &&
15 git commit -m initial &&
19 test_expect_success
'interrupted am --whitespace=fix' '
20 rm -rf .git/rebase-apply &&
21 git reset --hard initial &&
22 test_must_fail git am --whitespace=fix "$tm"/am-test-1-? &&
28 test_expect_success
'interrupted am -C1' '
29 rm -rf .git/rebase-apply &&
30 git reset --hard initial &&
31 test_must_fail git am -C1 "$tm"/am-test-2-? &&
37 test_expect_success
'interrupted am -p2' '
38 rm -rf .git/rebase-apply &&
39 git reset --hard initial &&
40 test_must_fail git am -p2 "$tm"/am-test-3-? &&
46 test_expect_success
'interrupted am -C1 -p2' '
47 rm -rf .git/rebase-apply &&
48 git reset --hard initial &&
49 test_must_fail git am -p2 -C1 "$tm"/am-test-4-? &&
55 test_expect_success
'interrupted am --directory="frotz nitfol"' '
56 rm -rf .git/rebase-apply &&
57 git reset --hard initial &&
58 test_must_fail git am --directory="frotz nitfol" "$tm"/am-test-5-? &&
60 grep One "frotz nitfol/file-5"
63 test_expect_success
'apply to a funny path' '
64 with_sq="with'\''sq" &&
65 rm -fr .git/rebase-apply &&
66 git reset --hard initial &&
67 git am --directory="$with_sq" "$tm"/am-test-5-2 &&
68 test -f "$with_sq/file-5"
71 test_expect_success
'am --reject' '
72 rm -rf .git/rebase-apply &&
73 git reset --hard initial &&
74 test_must_fail git am --reject "$tm"/am-test-6-1 &&
75 grep "@@ -1,3 +1,3 @@" file-2.rej &&
76 test_must_fail git diff-files --exit-code --quiet file-2 &&
77 grep "[-]-reject" .git/rebase-apply/apply-opt