Merge branch 'sg/stash-k-i'
[tgit.git] / t / t6028-merge-up-to-date.sh
blobf8f3e3ff2c00df468f5703a4e0ac31f52e42e06d
1 #!/bin/sh
3 test_description='merge fast forward and up to date'
5 . ./test-lib.sh
7 test_expect_success setup '
8 >file &&
9 git add file &&
10 test_tick &&
11 git commit -m initial &&
12 git tag c0 &&
14 echo second >file &&
15 git add file &&
16 test_tick &&
17 git commit -m second &&
18 git tag c1 &&
19 git branch test
22 test_expect_success 'merge -s recursive up-to-date' '
24 git reset --hard c1 &&
25 test_tick &&
26 git merge -s recursive c0 &&
27 expect=$(git rev-parse c1) &&
28 current=$(git rev-parse HEAD) &&
29 test "$expect" = "$current"
33 test_expect_success 'merge -s recursive fast-forward' '
35 git reset --hard c0 &&
36 test_tick &&
37 git merge -s recursive c1 &&
38 expect=$(git rev-parse c1) &&
39 current=$(git rev-parse HEAD) &&
40 test "$expect" = "$current"
44 test_expect_success 'merge -s ours up-to-date' '
46 git reset --hard c1 &&
47 test_tick &&
48 git merge -s ours c0 &&
49 expect=$(git rev-parse c1) &&
50 current=$(git rev-parse HEAD) &&
51 test "$expect" = "$current"
55 test_expect_success 'merge -s ours fast-forward' '
57 git reset --hard c0 &&
58 test_tick &&
59 git merge -s ours c1 &&
60 expect=$(git rev-parse c0^{tree}) &&
61 current=$(git rev-parse HEAD^{tree}) &&
62 test "$expect" = "$current"
66 test_expect_success 'merge -s subtree up-to-date' '
68 git reset --hard c1 &&
69 test_tick &&
70 git merge -s subtree c0 &&
71 expect=$(git rev-parse c1) &&
72 current=$(git rev-parse HEAD) &&
73 test "$expect" = "$current"
77 test_done