3 # Copyright (c) 2005 Petr Baudis
5 test_description
="Tests cg-merge discovering multiple bases
7 Creates a commit DAG generating multiple bases and checks how does cg-merge
14 test_expect_success
'initialize repo' \
15 '(cg-init -m"Initial commit" && cg-tag initial)'
17 # We will create the classic criss-cross scenario.
19 test_expect_success
'branch A commit 1' \
20 '(cg-commit -f -m"branch A commit 1" && cp .git/refs/heads/master .git/refs/heads/branchA)'
21 test_expect_success
'branch B commit 1' \
22 '(cg-object-id -c initial >.git/refs/heads/master &&
23 cg-commit -f -m"branch B commit 1" && cp .git/refs/heads/master .git/refs/heads/branchB)'
24 test_expect_success
'branch A commit 2' \
25 '(cg-object-id -c branchA >.git/refs/heads/master &&
26 mkdir -p .git/cg-merge-state &&
27 cg-object-id -c branchB >.git/cg-merge-state/merging &&
28 cg-commit -f -m"branch A commit 2" && cp .git/refs/heads/master .git/refs/heads/branchA)'
29 test_expect_success
'branch B commit 2' \
30 '(cg-object-id -c branchB >.git/refs/heads/master &&
31 mkdir -p .git/cg-merge-state &&
32 cg-object-id -p branchA >.git/cg-merge-state/merging &&
33 cg-commit -f -m"branch B commit 2" && cp .git/refs/heads/master .git/refs/heads/branchB)'
35 # We end up in branch B
36 test_expect_failure
'try to merge branch A and B' \
37 'cg-merge branchA 2>log'
38 # If we cut out everything, only the first guide and one empty line stays
39 test_expect_success
'check cg-merge'\''s proposal' \
40 '[ "$(grep -Ev "^$(cg-object-id -p branchA | tr '\''\n'\'' "|")somethingnonsensical\$" log |
41 grep -v ": $(cg-object-id -c initial)\$" | wc -l)" = "2" ]'