Skip to content

Commit e3ae6bb

Browse files
Sam Vilaingitster
authored andcommitted
cleanup merge-base test script
Add a picture, and keep the setup and the tests together. Signed-off-by: Sam Vilain <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1164f1e commit e3ae6bb

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

t/t6010-merge-base.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ doit() {
3434
echo $commit
3535
}
3636

37+
# E---D---C---B---A
38+
# \'-_ \ \
39+
# \ `---------G \
40+
# \ \
41+
# F----------------H
42+
3743
# Setup...
3844
E=$(doit 5 E)
3945
D=$(doit 4 D $E)
@@ -44,6 +50,18 @@ A=$(doit 1 A $B)
4450
G=$(doit 7 G $B $E)
4551
H=$(doit 8 H $A $F)
4652

53+
test_expect_success 'compute merge-base (single)' \
54+
'MB=$(git-merge-base G H) &&
55+
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
56+
57+
test_expect_success 'compute merge-base (all)' \
58+
'MB=$(git-merge-base --all G H) &&
59+
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
60+
61+
test_expect_success 'compute merge-base with show-branch' \
62+
'MB=$(git-show-branch --merge-base G H) &&
63+
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
64+
4765
# Setup for second test to demonstrate that relying on timestamps in a
4866
# distributed SCM to provide a _consistent_ partial ordering of commits
4967
# leads to insanity.
@@ -81,18 +99,6 @@ R2=$(doit 3 R2 $R1)
8199
PL=$(doit 4 PL $L2 $C2)
82100
PR=$(doit 4 PR $C2 $R2)
83101

84-
test_expect_success 'compute merge-base (single)' \
85-
'MB=$(git-merge-base G H) &&
86-
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
87-
88-
test_expect_success 'compute merge-base (all)' \
89-
'MB=$(git-merge-base --all G H) &&
90-
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
91-
92-
test_expect_success 'compute merge-base with show-branch' \
93-
'MB=$(git-show-branch --merge-base G H) &&
94-
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
95-
96102
test_expect_success 'compute merge-base (single)' \
97103
'MB=$(git-merge-base PL PR) &&
98104
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"'

0 commit comments

Comments
 (0)