summaryrefslogtreecommitdiff
path: root/t/t6028-merge-up-to-date.sh
blob: a91644e3b2ac3490cfe49d5e67c9736197cd56a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh
 
test_description='merge fast-forward and up to date'
 
. ./test-lib.sh
 
test_expect_success setup '
	>file &&
	git add file &&
	test_tick &&
	git commit -m initial &&
	git tag c0 &&
 
	echo second >file &&
	git add file &&
	test_tick &&
	git commit -m second &&
	git tag c1 &&
	git branch test
'
 
test_expect_success 'merge -s recursive up-to-date' '
 
	git reset --hard c1 &&
	test_tick &&
	git merge -s recursive c0 &&
	expect=$(git rev-parse c1) &&
	current=$(git rev-parse HEAD) &&
	test "$expect" = "$current"
 
'
 
test_expect_success 'merge -s recursive fast-forward' '
 
	git reset --hard c0 &&
	test_tick &&
	git merge -s recursive c1 &&
	expect=$(git rev-parse c1) &&
	current=$(git rev-parse HEAD) &&
	test "$expect" = "$current"
 
'
 
test_expect_success 'merge -s ours up-to-date' '
 
	git reset --hard c1 &&
	test_tick &&
	git merge -s ours c0 &&
	expect=$(git rev-parse c1) &&
	current=$(git rev-parse HEAD) &&
	test "$expect" = "$current"
 
'
 
test_expect_success 'merge -s ours fast-forward' '
 
	git reset --hard c0 &&
	test_tick &&
	git merge -s ours c1 &&
	expect=$(git rev-parse c0^{tree}) &&
	current=$(git rev-parse HEAD^{tree}) &&
	test "$expect" = "$current"
 
'
 
test_expect_success 'merge -s subtree up-to-date' '
 
	git reset --hard c1 &&
	test_tick &&
	git merge -s subtree c0 &&
	expect=$(git rev-parse c1) &&
	current=$(git rev-parse HEAD) &&
	test "$expect" = "$current"
 
'
 
test_done