Junio C Hamano | a005085 | 2007-08-15 23:19:55 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Felipe Contreras | a75d7b5 | 2009-10-24 11:31:32 +0300 | [diff] [blame] | 3 | test_description='merge fast-forward and up to date' |
Junio C Hamano | a005085 | 2007-08-15 23:19:55 -0700 | [diff] [blame] | 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success setup ' |
| 8 | >file && |
| 9 | git add file && |
| 10 | test_tick && |
| 11 | git commit -m initial && |
| 12 | git tag c0 && |
| 13 | |
| 14 | echo second >file && |
| 15 | git add file && |
| 16 | test_tick && |
| 17 | git commit -m second && |
| 18 | git tag c1 && |
Michał Kiedrowicz | 833abdc | 2012-02-13 12:48:56 +0100 | [diff] [blame] | 19 | git branch test && |
| 20 | echo third >file && |
| 21 | git add file && |
| 22 | test_tick && |
| 23 | git commit -m third && |
| 24 | git tag c2 |
Junio C Hamano | a005085 | 2007-08-15 23:19:55 -0700 | [diff] [blame] | 25 | ' |
| 26 | |
| 27 | test_expect_success 'merge -s recursive up-to-date' ' |
| 28 | |
| 29 | git reset --hard c1 && |
| 30 | test_tick && |
| 31 | git merge -s recursive c0 && |
| 32 | expect=$(git rev-parse c1) && |
| 33 | current=$(git rev-parse HEAD) && |
| 34 | test "$expect" = "$current" |
| 35 | |
| 36 | ' |
| 37 | |
| 38 | test_expect_success 'merge -s recursive fast-forward' ' |
| 39 | |
| 40 | git reset --hard c0 && |
| 41 | test_tick && |
| 42 | git merge -s recursive c1 && |
| 43 | expect=$(git rev-parse c1) && |
| 44 | current=$(git rev-parse HEAD) && |
| 45 | test "$expect" = "$current" |
| 46 | |
| 47 | ' |
| 48 | |
| 49 | test_expect_success 'merge -s ours up-to-date' ' |
| 50 | |
| 51 | git reset --hard c1 && |
| 52 | test_tick && |
| 53 | git merge -s ours c0 && |
| 54 | expect=$(git rev-parse c1) && |
| 55 | current=$(git rev-parse HEAD) && |
| 56 | test "$expect" = "$current" |
| 57 | |
| 58 | ' |
| 59 | |
| 60 | test_expect_success 'merge -s ours fast-forward' ' |
| 61 | |
| 62 | git reset --hard c0 && |
| 63 | test_tick && |
| 64 | git merge -s ours c1 && |
| 65 | expect=$(git rev-parse c0^{tree}) && |
| 66 | current=$(git rev-parse HEAD^{tree}) && |
| 67 | test "$expect" = "$current" |
| 68 | |
| 69 | ' |
| 70 | |
| 71 | test_expect_success 'merge -s subtree up-to-date' ' |
| 72 | |
| 73 | git reset --hard c1 && |
| 74 | test_tick && |
| 75 | git merge -s subtree c0 && |
| 76 | expect=$(git rev-parse c1) && |
| 77 | current=$(git rev-parse HEAD) && |
| 78 | test "$expect" = "$current" |
| 79 | |
| 80 | ' |
| 81 | |
Junio C Hamano | e78cbf8 | 2012-04-17 12:22:26 -0700 | [diff] [blame] | 82 | test_expect_success 'merge fast-forward octopus' ' |
Michał Kiedrowicz | 833abdc | 2012-02-13 12:48:56 +0100 | [diff] [blame] | 83 | |
| 84 | git reset --hard c0 && |
| 85 | test_tick && |
Jeff King | 60687de | 2015-03-20 06:06:44 -0400 | [diff] [blame] | 86 | git merge c1 c2 && |
Michał Kiedrowicz | 833abdc | 2012-02-13 12:48:56 +0100 | [diff] [blame] | 87 | expect=$(git rev-parse c2) && |
| 88 | current=$(git rev-parse HEAD) && |
| 89 | test "$expect" = "$current" |
| 90 | ' |
| 91 | |
Junio C Hamano | a005085 | 2007-08-15 23:19:55 -0700 | [diff] [blame] | 92 | test_done |