Miklos Vajna | 3f4d1c6 | 2008-07-13 00:33:35 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Nanako Shiraishi | 47a528a | 2008-09-03 17:59:33 +0900 | [diff] [blame] | 3 | test_description='git merge |
Miklos Vajna | 3f4d1c6 | 2008-07-13 00:33:35 +0200 | [diff] [blame] | 4 | |
| 5 | Testing the resolve strategy.' |
| 6 | |
| 7 | . ./test-lib.sh |
| 8 | |
| 9 | test_expect_success 'setup' ' |
| 10 | echo c0 > c0.c && |
| 11 | git add c0.c && |
| 12 | git commit -m c0 && |
| 13 | git tag c0 && |
| 14 | echo c1 > c1.c && |
| 15 | git add c1.c && |
| 16 | git commit -m c1 && |
| 17 | git tag c1 && |
| 18 | git reset --hard c0 && |
| 19 | echo c2 > c2.c && |
| 20 | git add c2.c && |
| 21 | git commit -m c2 && |
| 22 | git tag c2 && |
| 23 | git reset --hard c0 && |
| 24 | echo c3 > c2.c && |
| 25 | git add c2.c && |
| 26 | git commit -m c3 && |
| 27 | git tag c3 |
| 28 | ' |
| 29 | |
| 30 | test_expect_success 'merge c1 to c2' ' |
| 31 | git reset --hard c1 && |
| 32 | git merge -s resolve c2 && |
| 33 | test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && |
| 34 | test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" && |
| 35 | test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" && |
| 36 | git diff --exit-code && |
| 37 | test -f c0.c && |
| 38 | test -f c1.c && |
Junio C Hamano | 446247d | 2008-08-23 12:56:57 -0700 | [diff] [blame] | 39 | test -f c2.c && |
| 40 | test 3 = $(git ls-tree -r HEAD | wc -l) && |
| 41 | test 3 = $(git ls-files | wc -l) |
Miklos Vajna | 3f4d1c6 | 2008-07-13 00:33:35 +0200 | [diff] [blame] | 42 | ' |
| 43 | |
| 44 | test_expect_success 'merge c2 to c3 (fails)' ' |
| 45 | git reset --hard c2 && |
| 46 | test_must_fail git merge -s resolve c3 |
| 47 | ' |
| 48 | test_done |