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

Additional merge-base tests (revised)

Signed-off-by: A Large Angry SCM <gitzilla@gmail.com>

A Large Angry SCM committed Jul 4, 2006 at 17:35 UTC cd6f207a445f96966eb119b874306dca291fcd22
1 file changed +45
t/t6010-merge-base.sh
+45
@@ -44,6 +44,43 @@ A=$(doit 1 A $B)
44 G=$(doit 7 G $B $E)
45 H=$(doit 8 H $A $F)
46
47 +# Setup for second test to demonstrate that relying on timestamps in a
48 +# distributed SCM to provide a _consistent_ partial ordering of commits
49 +# leads to insanity.
50 +#
51 +# Relative
52 +# Structure timestamps
53 +#
54 +# PL PR +4 +4
55 +# / \/ \ / \/ \
56 +# L2 C2 R2 +3 -1 +3
57 +# | | | | | |
58 +# L1 C1 R1 +2 -2 +2
59 +# | | | | | |
60 +# L0 C0 R0 +1 -3 +1
61 +# \ | / \ | /
62 +# S 0
63 +#
64 +# The left and right chains of commits can be of any length and complexity as
65 +# long as all of the timestamps are greater than that of S.
66 +
67 +S=$(doit 0 S)
68 +
69 +C0=$(doit -3 C0 $S)
70 +C1=$(doit -2 C1 $C0)
71 +C2=$(doit -1 C2 $C1)
72 +
73 +L0=$(doit 1 L0 $S)
74 +L1=$(doit 2 L1 $L0)
75 +L2=$(doit 3 L2 $L1)
76 +
77 +R0=$(doit 1 R0 $S)
78 +R1=$(doit 2 R1 $R0)
79 +R2=$(doit 3 R2 $R1)
80 +
81 +PL=$(doit 4 PL $L2 $C2)
82 +PR=$(doit 4 PR $C2 $R2)
83 +
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"'
@@ -56,4 +93,12 @@ 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
96 +test_expect_success 'compute merge-base (single)' \
97 + 'MB=$(git-merge-base PL PR) &&
98 + expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"'
99 +
100 +test_expect_success 'compute merge-base (all)' \
101 + 'MB=$(git-merge-base --all PL PR) &&
102 + expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"'
103 +
104 test_done