(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'basic git merge-index / git-merge-one-file tests'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <'setup diverging branches'>)} { (SQ <'\n'> <'\tfor i in 1 2 3 4 5 6 7 8 9 10; do\n'> <'\t\techo $i\n'> <'\tdone >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m base &&\n'> <'\tgit tag base &&\n'> <'\tsed s/2/two/ <file >tmp &&\n'> <'\tmv tmp file &&\n'> <'\tgit commit -a -m two &&\n'> <'\tgit tag two &&\n'> <'\tgit checkout -b other HEAD^ &&\n'> <'\tsed s/10/ten/ <file >tmp &&\n'> <'\tmv tmp file &&\n'> <'\tgit commit -a -m ten &&\n'> <'\tgit tag ten\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect-merged>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(SQ <EOF>)} here_end_span_id: 60 stdin_parts: [ <'1\n'> <'two\n'> <'3\n'> <'4\n'> <'5\n'> <'6\n'> <'7\n'> <'8\n'> <'9\n'> <'ten\n'> ] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'read-tree does not resolve content merge'>)} { (SQ <'\n'> <'\tgit read-tree -i -m base ten two &&\n'> <'\techo file >expect &&\n'> <'\tgit diff-files --name-only --diff-filter=U >unmerged &&\n'> <'\ttest_cmp expect unmerged\n'> ) } ) (C {<test_expect_success>} {(SQ <'git merge-index git-merge-one-file resolves'>)} { (SQ <'\n'> <'\tgit merge-index git-merge-one-file -a &&\n'> <'\tgit diff-files --name-only --diff-filter=U >unmerged &&\n'> <'\t>expect &&\n'> <'\ttest_cmp expect unmerged &&\n'> <'\ttest_cmp expect-merged file &&\n'> <'\tgit cat-file blob :file >file-index &&\n'> <'\ttest_cmp expect-merged file-index\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup bare merge'>)} { (SQ <'\n'> <'\tgit clone --bare . bare.git &&\n'> <'\t(cd bare.git &&\n'> <'\t GIT_INDEX_FILE=$PWD/merge.index &&\n'> <'\t export GIT_INDEX_FILE &&\n'> <'\t git read-tree -i -m base ten two\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-one-file fails without a work tree'>)} { (SQ <'\n'> <'\t(cd bare.git &&\n'> <'\t GIT_INDEX_FILE=$PWD/merge.index &&\n'> <'\t export GIT_INDEX_FILE &&\n'> <'\t test_must_fail git merge-index git-merge-one-file -a\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-one-file respects GIT_WORK_TREE'>)} { (SQ <'\n'> <'\t(cd bare.git &&\n'> <'\t mkdir work &&\n'> <'\t GIT_WORK_TREE=$PWD/work &&\n'> <'\t export GIT_WORK_TREE &&\n'> <'\t GIT_INDEX_FILE=$PWD/merge.index &&\n'> <'\t export GIT_INDEX_FILE &&\n'> <'\t git merge-index git-merge-one-file -a &&\n'> <'\t git cat-file blob :file >work/file-index\n'> <'\t) &&\n'> <'\ttest_cmp expect-merged bare.git/work/file &&\n'> <'\ttest_cmp expect-merged bare.git/work/file-index\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-one-file respects core.worktree'>)} { (SQ <'\n'> <'\tmkdir subdir &&\n'> <'\tgit clone . subdir/child &&\n'> <'\t(cd subdir &&\n'> <'\t GIT_DIR=$PWD/child/.git &&\n'> <'\t export GIT_DIR &&\n'> <'\t git config core.worktree "$PWD/child" &&\n'> <'\t git read-tree -i -m base ten two &&\n'> <'\t git merge-index git-merge-one-file -a &&\n'> <'\t git cat-file blob :file >file-index\n'> <'\t) &&\n'> <'\ttest_cmp expect-merged subdir/child/file &&\n'> <'\ttest_cmp expect-merged subdir/file-index\n'> ) } ) (C {<test_done>}) ] )