Test commit
[cogito/jonas.git] / t / t9206-merge-multi-base.sh
blob8bcd24a650a24fc297453c00c677d9a5379c2bf8
1 #!/usr/bin/env bash
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
8 deal with it."
10 . ./test-lib.sh
11 rm -rf .git
13 echo file1 >file1
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" ]'
44 test_done