]> git.ipfire.org Git - thirdparty/git.git/blob - t/t6028-merge-up-to-date.sh
git-p4: replace each tab with 8 spaces for consistency
[thirdparty/git.git] / t / t6028-merge-up-to-date.sh
1 #!/bin/sh
2
3 test_description='merge fast-forward and up to date'
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 &&
19 git branch test
20 '
21
22 test_expect_success 'merge -s recursive up-to-date' '
23
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"
30
31 '
32
33 test_expect_success 'merge -s recursive fast-forward' '
34
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"
41
42 '
43
44 test_expect_success 'merge -s ours up-to-date' '
45
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"
52
53 '
54
55 test_expect_success 'merge -s ours fast-forward' '
56
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"
63
64 '
65
66 test_expect_success 'merge -s subtree up-to-date' '
67
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"
74
75 '
76
77 test_done