@matheusbsbs / matheus-bagliano / commits / e3ae6bb9aa
Fork 0

cleanup merge-base test script

Add a picture, and keep the setup and the tests together. Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sam Vilain committed Jun 27, 2007 at 11:44 UTC e3ae6bb9aaf030251f1d13c4de3aa220cf282460
1 file changed +18 -12
t/t6010-merge-base.sh
+18 -12
@@ -34,6 +34,12 @@ doit() {
34 echo $commit
35 }
36
37 +# E---D---C---B---A
38 +# \'-_ \ \
39 +# \ `---------G \
40 +# \ \
41 +# F----------------H
42 +
43 # Setup...
44 E=$(doit 5 E)
45 D=$(doit 4 D $E)
@@ -44,6 +50,18 @@ A=$(doit 1 A $B)
50 G=$(doit 7 G $B $E)
51 H=$(doit 8 H $A $F)
52
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 +
65 # Setup for second test to demonstrate that relying on timestamps in a
66 # distributed SCM to provide a _consistent_ partial ordering of commits
67 # leads to insanity.
@@ -81,18 +99,6 @@ R2=$(doit 3 R2 $R1)
99 PL=$(doit 4 PL $L2 $C2)
100 PR=$(doit 4 PR $C2 $R2)
101
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 -
102 test_expect_success 'compute merge-base (single)' \
103 'MB=$(git-merge-base PL PR) &&
104 expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"'