setup: merge configuration of repository formats
[git/gitster.git] / t / t6408-merge-up-to-date.sh
blob8a1ba6d23a7dc4a7ca7a56988f3d945d9af38619
1 #!/bin/sh
3 test_description='merge fast-forward and up to date'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
9 >file &&
10 git add file &&
11 test_tick &&
12 git commit -m initial &&
13 git tag c0 &&
15 echo second >file &&
16 git add file &&
17 test_tick &&
18 git commit -m second &&
19 git tag c1 &&
20 git branch test &&
21 echo third >file &&
22 git add file &&
23 test_tick &&
24 git commit -m third &&
25 git tag c2
28 test_expect_success 'merge -s recursive up-to-date' '
30 git reset --hard c1 &&
31 test_tick &&
32 git merge -s recursive c0 &&
33 expect=$(git rev-parse c1) &&
34 current=$(git rev-parse HEAD) &&
35 test "$expect" = "$current"
39 test_expect_success 'merge -s recursive fast-forward' '
41 git reset --hard c0 &&
42 test_tick &&
43 git merge -s recursive c1 &&
44 expect=$(git rev-parse c1) &&
45 current=$(git rev-parse HEAD) &&
46 test "$expect" = "$current"
50 test_expect_success 'merge -s ours up-to-date' '
52 git reset --hard c1 &&
53 test_tick &&
54 git merge -s ours c0 &&
55 expect=$(git rev-parse c1) &&
56 current=$(git rev-parse HEAD) &&
57 test "$expect" = "$current"
61 test_expect_success 'merge -s ours fast-forward' '
63 git reset --hard c0 &&
64 test_tick &&
65 git merge -s ours c1 &&
66 expect=$(git rev-parse c0^{tree}) &&
67 current=$(git rev-parse HEAD^{tree}) &&
68 test "$expect" = "$current"
72 test_expect_success 'merge -s subtree up-to-date' '
74 git reset --hard c1 &&
75 test_tick &&
76 git merge -s subtree c0 &&
77 expect=$(git rev-parse c1) &&
78 current=$(git rev-parse HEAD) &&
79 test "$expect" = "$current"
83 test_expect_success 'merge fast-forward octopus' '
85 git reset --hard c0 &&
86 test_tick &&
87 git merge c1 c2 &&
88 expect=$(git rev-parse c2) &&
89 current=$(git rev-parse HEAD) &&
90 test "$expect" = "$current"
93 test_done