Git 2.45
[git/gitster.git] / t / t4252-am-options.sh
blob5b680dc755916ea0c165fb5de8a613679426378f
1 #!/bin/sh
3 test_description='git am with options and not losing them'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
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 &&
14 test_tick &&
15 git commit -m initial &&
16 git tag 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-? &&
23 git am --skip &&
24 grep 3 file-1 &&
25 grep "^Six$" file-2
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-? &&
32 git am --skip &&
33 grep 3 file-1 &&
34 grep "^Three$" file-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-? &&
41 git am --skip &&
42 grep 3 file-1 &&
43 grep "^Three$" file-2
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-? &&
50 git am --skip &&
51 grep 3 file-1 &&
52 grep "^Three$" file-2
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-? &&
59 git am --skip &&
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
80 test_done