(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'merging with submodules'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <'\n'> <'\n'> <'\tmkdir sub &&\n'> <'\t(cd sub &&\n'> <'\t git init &&\n'> <'\t echo original > file &&\n'> <'\t git add file &&\n'> <'\t test_tick &&\n'> <'\t git commit -m sub-root) &&\n'> <'\tgit add sub &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m root &&\n'> <'\n'> <'\tgit checkout -b a master &&\n'> <'\t(cd sub &&\n'> <'\t echo A > file &&\n'> <'\t git add file &&\n'> <'\t test_tick &&\n'> <'\t git commit -m sub-a) &&\n'> <'\tgit add sub &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m a &&\n'> <'\n'> <'\tgit checkout -b b master &&\n'> <'\t(cd sub &&\n'> <'\t echo B > file &&\n'> <'\t git add file &&\n'> <'\t test_tick &&\n'> <'\t git commit -m sub-b) &&\n'> <'\tgit add sub &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m b &&\n'> <'\n'> <'\tgit checkout -b c a &&\n'> <'\tgit merge -s ours b &&\n'> <'\n'> <'\tgit checkout -b d b &&\n'> <'\tgit merge -s ours a\n'> ) } ) (C {(test_expect_success)} {(SQ <'setup for merge search'>)} { (SQ <'\n'> <'\tmkdir merge-search &&\n'> <'\t(cd merge-search &&\n'> <'\tgit init &&\n'> <'\tmkdir sub &&\n'> <'\t(cd sub &&\n'> <'\t git init &&\n'> <'\t echo "file-a" > file-a &&\n'> <'\t git add file-a &&\n'> <'\t git commit -m "sub-a" &&\n'> <'\t git branch sub-a) &&\n'> <'\tgit commit --allow-empty -m init &&\n'> <'\tgit branch init &&\n'> <'\tgit add sub &&\n'> <'\tgit commit -m "a" &&\n'> <'\tgit branch a &&\n'> <'\n'> <'\tgit checkout -b b &&\n'> <'\t(cd sub &&\n'> <'\t git checkout -b sub-b &&\n'> <'\t echo "file-b" > file-b &&\n'> <'\t git add file-b &&\n'> <'\t git commit -m "sub-b") &&\n'> <'\tgit commit -a -m "b" &&\n'> <'\n'> <'\tgit checkout -b c a &&\n'> <'\t(cd sub &&\n'> <'\t git checkout -b sub-c sub-a &&\n'> <'\t echo "file-c" > file-c &&\n'> <'\t git add file-c &&\n'> <'\t git commit -m "sub-c") &&\n'> <'\tgit commit -a -m "c" &&\n'> <'\n'> <'\tgit checkout -b d a &&\n'> <'\t(cd sub &&\n'> <'\t git checkout -b sub-d sub-b &&\n'> <'\t git merge sub-c) &&\n'> <'\tgit commit -a -m "d" &&\n'> <'\tgit branch test b &&\n'> <'\n'> <'\tgit checkout -b g init &&\n'> <'\t(cd sub &&\n'> <'\t git checkout -b sub-g sub-c) &&\n'> <'\tgit add sub &&\n'> <'\tgit commit -a -m "g")\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge with one side as a fast-forward of the other'>)} { (SQ <'\n'> <'\t(cd merge-search &&\n'> <'\t git checkout -b test-forward b &&\n'> <'\t git merge d &&\n'> <'\t git ls-tree test-forward sub | cut -f1 | cut -f3 -d" " > actual &&\n'> <'\t (cd sub &&\n'> <'\t git rev-parse sub-d > ../expect) &&\n'> <'\t test_cmp actual expect)\n'> ) } ) (C {(test_expect_success)} {(SQ <'merging should conflict for non fast-forward'>)} { (SQ <'\n'> <'\t(cd merge-search &&\n'> <'\t git checkout -b test-nonforward b &&\n'> <'\t (cd sub &&\n'> <'\t git rev-parse sub-d > ../expect) &&\n'> <'\t test_must_fail git merge c 2> actual &&\n'> <'\t grep $(cat expect) actual > /dev/null &&\n'> <'\t git reset --hard)\n'> ) } ) (C {(test_expect_success)} {(SQ <'merging should fail for ambiguous common parent'>)} { (SQ <'\n'> <'\t(cd merge-search &&\n'> <'\tgit checkout -b test-ambiguous b &&\n'> <'\t(cd sub &&\n'> <'\t git checkout -b ambiguous sub-b &&\n'> <'\t git merge sub-c &&\n'> <'\t git rev-parse sub-d > ../expect1 &&\n'> <'\t git rev-parse ambiguous > ../expect2) &&\n'> <'\ttest_must_fail git merge c 2> actual &&\n'> <'\tgrep $(cat expect1) actual > /dev/null &&\n'> <'\tgrep $(cat expect2) actual > /dev/null &&\n'> <'\tgit reset --hard)\n'> ) } ) (C {(test_expect_success)} {(SQ <'merging should fail for changes that are backwards'>)} { (SQ <'\n'> <'\t(cd merge-search &&\n'> <'\tgit checkout -b bb a &&\n'> <'\t(cd sub &&\n'> <'\t git checkout sub-b) &&\n'> <'\tgit commit -a -m "bb" &&\n'> <'\n'> <'\tgit checkout -b e bb &&\n'> <'\t(cd sub &&\n'> <'\t git checkout sub-a) &&\n'> <'\tgit commit -a -m "e" &&\n'> <'\n'> <'\tgit checkout -b f bb &&\n'> <'\t(cd sub &&\n'> <'\t git checkout sub-d) &&\n'> <'\tgit commit -a -m "f" &&\n'> <'\n'> <'\tgit checkout -b test-backward e &&\n'> <'\ttest_must_fail git merge f)\n'> ) } ) (C {(test_expect_success)} {(SQ <'git submodule status should display the merge conflict properly with merge base'>)} { (SQ <'\n'> <' (cd merge-search &&\n'> <' cat >.gitmodules <<EOF &&\n'> <'[submodule "sub"]\n'> <' path = sub\n'> <' url = $TRASH_DIRECTORY/sub\n'> <'EOF\n'> <' cat >expect <<EOF &&\n'> <'U0000000000000000000000000000000000000000 sub\n'> <'EOF\n'> <' git submodule status > actual &&\n'> <' test_cmp expect actual &&\n'> <'\tgit reset --hard)\n'> ) } ) (C {(test_expect_success)} {(SQ <'git submodule status should display the merge conflict properly without merge-base'>)} { (SQ <'\n'> <' (cd merge-search &&\n'> <'\tgit checkout -b test-no-merge-base g &&\n'> <'\ttest_must_fail git merge b &&\n'> <' cat >.gitmodules <<EOF &&\n'> <'[submodule "sub"]\n'> <' path = sub\n'> <' url = $TRASH_DIRECTORY/sub\n'> <'EOF\n'> <' cat >expect <<EOF &&\n'> <'U0000000000000000000000000000000000000000 sub\n'> <'EOF\n'> <' git submodule status > actual &&\n'> <' test_cmp expect actual &&\n'> <' git reset --hard)\n'> ) } ) (C {(test_expect_success)} {(SQ <'merging with a modify/modify conflict between merge bases'>)} { (SQ <'\n'> <'\tgit reset --hard HEAD &&\n'> <'\tgit checkout -b test2 c &&\n'> <'\tgit merge d\n'> ) } ) (C {(test_expect_success)} {(SQ <'setup for recursive merge with submodule'>)} { (SQ <'\n'> <'\tmkdir merge-recursive &&\n'> <'\t(cd merge-recursive &&\n'> <'\t git init &&\n'> <'\t mkdir sub &&\n'> <'\t (cd sub &&\n'> <'\t git init &&\n'> <'\t test_commit a &&\n'> <'\t git checkout -b sub-b master &&\n'> <'\t test_commit b &&\n'> <'\t git checkout -b sub-c master &&\n'> <'\t test_commit c &&\n'> <'\t git checkout -b sub-bc sub-b &&\n'> <'\t git merge sub-c &&\n'> <'\t git checkout -b sub-cb sub-c &&\n'> <'\t git merge sub-b &&\n'> <'\t git checkout master) &&\n'> <'\t git add sub &&\n'> <'\t git commit -m a &&\n'> <'\t git checkout -b top-b master &&\n'> <'\t (cd sub && git checkout sub-b) &&\n'> <'\t git add sub &&\n'> <'\t git commit -m b &&\n'> <'\t git checkout -b top-c master &&\n'> <'\t (cd sub && git checkout sub-c) &&\n'> <'\t git add sub &&\n'> <'\t git commit -m c &&\n'> <'\t git checkout -b top-bc top-b &&\n'> <'\t git merge -s ours --no-commit top-c &&\n'> <'\t (cd sub && git checkout sub-bc) &&\n'> <'\t git add sub &&\n'> <'\t git commit -m bc &&\n'> <'\t git checkout -b top-cb top-c &&\n'> <'\t git merge -s ours --no-commit top-b &&\n'> <'\t (cd sub && git checkout sub-cb) &&\n'> <'\t git add sub &&\n'> <'\t git commit -m cb)\n'> ) } ) (C {(test_expect_success)} {(SQ <'recursive merge with submodule'>)} { (SQ <'\n'> <'\t(cd merge-recursive &&\n'> <'\t test_must_fail git merge top-bc &&\n'> <'\t echo "160000 $(git rev-parse top-cb:sub) 2\tsub" > expect2 &&\n'> <'\t echo "160000 $(git rev-parse top-bc:sub) 3\tsub" > expect3 &&\n'> <'\t git ls-files -u > actual &&\n'> <'\t grep "$(cat expect2)" actual > /dev/null &&\n'> <'\t grep "$(cat expect3)" actual > /dev/null)\n'> ) } ) (C {(test_done)}) ] )