]>
Commit | Line | Data |
---|---|---|
a0050852 JH |
1 | #!/bin/sh |
2 | ||
a75d7b54 | 3 | test_description='merge fast-forward and up to date' |
a0050852 | 4 | |
3e3b9321 | 5 | TEST_PASSES_SANITIZE_LEAK=true |
a0050852 JH |
6 | . ./test-lib.sh |
7 | ||
8 | test_expect_success setup ' | |
9 | >file && | |
10 | git add file && | |
11 | test_tick && | |
12 | git commit -m initial && | |
13 | git tag c0 && | |
14 | ||
15 | echo second >file && | |
16 | git add file && | |
17 | test_tick && | |
18 | git commit -m second && | |
19 | git tag c1 && | |
833abdc9 MK |
20 | git branch test && |
21 | echo third >file && | |
22 | git add file && | |
23 | test_tick && | |
24 | git commit -m third && | |
25 | git tag c2 | |
a0050852 JH |
26 | ' |
27 | ||
28 | test_expect_success 'merge -s recursive up-to-date' ' | |
29 | ||
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" | |
36 | ||
37 | ' | |
38 | ||
39 | test_expect_success 'merge -s recursive fast-forward' ' | |
40 | ||
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" | |
47 | ||
48 | ' | |
49 | ||
50 | test_expect_success 'merge -s ours up-to-date' ' | |
51 | ||
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" | |
58 | ||
59 | ' | |
60 | ||
61 | test_expect_success 'merge -s ours fast-forward' ' | |
62 | ||
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" | |
69 | ||
70 | ' | |
71 | ||
72 | test_expect_success 'merge -s subtree up-to-date' ' | |
73 | ||
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" | |
80 | ||
81 | ' | |
82 | ||
e78cbf8c | 83 | test_expect_success 'merge fast-forward octopus' ' |
833abdc9 MK |
84 | |
85 | git reset --hard c0 && | |
86 | test_tick && | |
60687de5 | 87 | git merge c1 c2 && |
833abdc9 MK |
88 | expect=$(git rev-parse c2) && |
89 | current=$(git rev-parse HEAD) && | |
90 | test "$expect" = "$current" | |
91 | ' | |
92 | ||
a0050852 | 93 | test_done |