3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='Merge base computation.
16 export GIT_COMMITTER_EMAIL
=git@
comm.iter.xz
17 export GIT_COMMITTER_NAME
='C O Mmiter'
18 export GIT_AUTHOR_NAME
='A U Thor'
19 export GIT_AUTHOR_EMAIL
=git@au.thor.xz
27 PARENTS
="${PARENTS}-p $P "
29 GIT_COMMITTER_DATE
="$(($M + $OFFSET)) $Z"
30 GIT_AUTHOR_DATE
=$GIT_COMMITTER_DATE
31 export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
32 commit
=$
(echo $NAME | git commit-tree
$T $PARENTS)
33 echo $commit >.git
/refs
/tags
/$NAME
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"'
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"'
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"'
65 # Setup for second test to demonstrate that relying on timestamps in a
66 # distributed SCM to provide a _consistent_ partial ordering of commits
70 # Structure timestamps
82 # The left and right chains of commits can be of any length and complexity as
83 # long as all of the timestamps are greater than that of S.
99 PL
=$
(doit
4 PL
$L2 $C2)
100 PR
=$
(doit
4 PR
$C2 $R2)
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"'
106 test_expect_success
'compute merge-base (all)' \
107 'MB=$(git merge-base --all PL PR) &&
108 expr "$(git name-rev "$MB")" : "[0-9a-f]* tags/C2"'