Junio C Hamano | fe6beab | 2008-12-04 17:08:48 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
martin f. krafft | b80da42 | 2009-01-23 11:31:21 +1100 | [diff] [blame] | 3 | test_description='git am with options and not losing them' |
Junio C Hamano | fe6beab | 2008-12-04 17:08:48 -0800 | [diff] [blame] | 4 | . ./test-lib.sh |
| 5 | |
| 6 | tm="$TEST_DIRECTORY/t4252" |
| 7 | |
| 8 | test_expect_success setup ' |
| 9 | cp "$tm/file-1-0" file-1 && |
| 10 | cp "$tm/file-2-0" file-2 && |
| 11 | git add file-1 file-2 && |
| 12 | test_tick && |
| 13 | git commit -m initial && |
| 14 | git tag initial |
| 15 | ' |
| 16 | |
| 17 | test_expect_success 'interrupted am --whitespace=fix' ' |
| 18 | rm -rf .git/rebase-apply && |
| 19 | git reset --hard initial && |
| 20 | test_must_fail git am --whitespace=fix "$tm"/am-test-1-? && |
| 21 | git am --skip && |
| 22 | grep 3 file-1 && |
| 23 | grep "^Six$" file-2 |
| 24 | ' |
| 25 | |
| 26 | test_expect_success 'interrupted am -C1' ' |
| 27 | rm -rf .git/rebase-apply && |
| 28 | git reset --hard initial && |
| 29 | test_must_fail git am -C1 "$tm"/am-test-2-? && |
| 30 | git am --skip && |
| 31 | grep 3 file-1 && |
| 32 | grep "^Three$" file-2 |
| 33 | ' |
| 34 | |
| 35 | test_expect_success 'interrupted am -p2' ' |
| 36 | rm -rf .git/rebase-apply && |
| 37 | git reset --hard initial && |
| 38 | test_must_fail git am -p2 "$tm"/am-test-3-? && |
| 39 | git am --skip && |
| 40 | grep 3 file-1 && |
| 41 | grep "^Three$" file-2 |
| 42 | ' |
| 43 | |
| 44 | test_expect_success 'interrupted am -C1 -p2' ' |
| 45 | rm -rf .git/rebase-apply && |
| 46 | git reset --hard initial && |
| 47 | test_must_fail git am -p2 -C1 "$tm"/am-test-4-? && |
Junio C Hamano | fe6beab | 2008-12-04 17:08:48 -0800 | [diff] [blame] | 48 | git am --skip && |
| 49 | grep 3 file-1 && |
| 50 | grep "^Three$" file-2 |
| 51 | ' |
| 52 | |
Junio C Hamano | b47dfe9 | 2009-01-11 22:21:48 -0800 | [diff] [blame] | 53 | test_expect_success 'interrupted am --directory="frotz nitfol"' ' |
| 54 | rm -rf .git/rebase-apply && |
| 55 | git reset --hard initial && |
| 56 | test_must_fail git am --directory="frotz nitfol" "$tm"/am-test-5-? && |
| 57 | git am --skip && |
| 58 | grep One "frotz nitfol/file-5" |
| 59 | ' |
| 60 | |
Junio C Hamano | 17f26a9 | 2009-01-14 16:29:59 -0800 | [diff] [blame] | 61 | test_expect_success 'apply to a funny path' ' |
Jonathan Nieder | a48fcd8 | 2010-10-30 20:46:54 -0500 | [diff] [blame] | 62 | with_sq="with'\''sq" && |
Junio C Hamano | 17f26a9 | 2009-01-14 16:29:59 -0800 | [diff] [blame] | 63 | rm -fr .git/rebase-apply && |
| 64 | git reset --hard initial && |
| 65 | git am --directory="$with_sq" "$tm"/am-test-5-2 && |
| 66 | test -f "$with_sq/file-5" |
| 67 | ' |
| 68 | |
martin f. krafft | b80da42 | 2009-01-23 11:31:21 +1100 | [diff] [blame] | 69 | test_expect_success 'am --reject' ' |
| 70 | rm -rf .git/rebase-apply && |
| 71 | git reset --hard initial && |
| 72 | test_must_fail git am --reject "$tm"/am-test-6-1 && |
| 73 | grep "@@ -1,3 +1,3 @@" file-2.rej && |
| 74 | test_must_fail git diff-files --exit-code --quiet file-2 && |
| 75 | grep "[-]-reject" .git/rebase-apply/apply-opt |
| 76 | ' |
| 77 | |
Junio C Hamano | fe6beab | 2008-12-04 17:08:48 -0800 | [diff] [blame] | 78 | test_done |