(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <'git merge\n'> <'\n'> <'Testing basic merge operations/option parsing.\n'> <'\n'> <'! [c0] commit 0\n'> <' ! [c1] commit 1\n'> <' ! [c2] commit 2\n'> <' ! [c3] commit 3\n'> <' ! [c4] c4\n'> <' ! [c5] c5\n'> <' ! [c6] c6\n'> <' * [master] Merge commit '> ) (c1) (SQ <'\n'> <'--------\n'> <' - [master] Merge commit '>) (c1) (SQ <'\n'> <' + * [c1] commit 1\n'> <' + [c6] c6\n'> <' + [c5] c5\n'> <' ++ [c4] c4\n'> <' ++++ [c3] commit 3\n'> <' + [c2] commit 2\n'> <'+++++++* [c0] commit 0\n'> ) } spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_Name '$TEST_DIRECTORY')) (/lib-gpg.sh)}) (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(9)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(file)} spids:[83])] ) (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(9)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(file.1)} spids:[112])] ) (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(SQ <'5 X'>)} {(6)} {(7)} {(8)} {(9)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(file.5)} spids:[141])] ) (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(SQ <'9 X'>)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(file.9)} spids:[170])] ) (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(SQ <'9 Y'>)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(file.9y)} spids:[199])] ) (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(9)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(result.1)} spids:[228])] ) (SimpleCommand words: [ {(printf)} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {(2)} {(3)} {(4)} {(SQ <'5 X'>)} {(6)} {(7)} {(8)} {(9)} ] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(result.1-5)} spids:[259])] ) (SimpleCommand words: [ {(printf)} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {(2)} {(3)} {(4)} {(SQ <'5 X'>)} {(6)} {(7)} {(8)} {(SQ <'9 X'>)} ] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(result.1-5-9)} spids:[292])] ) (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(1)} {(2)} {(3)} {(4)} {(5)} {(6)} {(7)} {(8)} {(SQ <'9 Z'>)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(result.9z)} spids:[321])] ) (SimpleCommand redirects:[(Redir op_id:Redir_Great fd:-1 arg_word:{(empty)} spids:[324])]) (FuncDef name: create_merge_msgs body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(echo)} {(DQ ("Merge tag 'c2'"))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(msg.1-5)} spids:[342])] ) (AndOr children: [ (SimpleCommand words: [{(echo)} {(DQ ("Merge tags 'c2' and 'c3'"))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(msg.1-5-9)} spids:[354])] ) (AndOr children: [ (BraceGroup children: [ (AndOr children: [ (C {(echo)} {(DQ ('Squashed commit of the following:'))}) (AndOr children: [ (C {(echo)}) (C {(git)} {(log)} {(--no-merges)} {(Lit_Other '^') (HEAD)} {(c1)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(squash.1)} spids: [391] ) ] spids: [360] ) (AndOr children: [ (BraceGroup children: [ (AndOr children: [ (C {(echo)} {(DQ ('Squashed commit of the following:'))}) (AndOr children: [ (C {(echo)}) (C {(git)} {(log)} {(--no-merges)} {(Lit_Other '^') (HEAD)} {(c2)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(squash.1-5)} spids: [428] ) ] spids: [397] ) (AndOr children: [ (BraceGroup children: [ (AndOr children: [ (C {(echo)} {(DQ ('Squashed commit of the following:'))}) (AndOr children: [ (C {(echo)}) (C {(git)} {(log)} {(--no-merges)} {(Lit_Other '^') (HEAD)} {(c2)} {(c3)} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(squash.1-5-9)} spids: [467] ) ] spids: [434] ) (AndOr children: [ (SimpleCommand words: [{(Lit_Other ':')}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(msg.nologff)} spids: [475] ) ] ) (AndOr children: [ (SimpleCommand words: [{(Lit_Other ':')}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(msg.nolognoff)} spids: [483] ) ] ) (BraceGroup children: [ (AndOr children: [ (C {(echo)} {(DQ ("* tag 'c3':"))}) (C {(echo)} {(DQ (' commit 3'))}) ] op_id: Op_DAmp ) ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(msg.log)} spids: [510] ) ] spids: [489] ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [333] ) spids: [328 332] ) (FuncDef name: verify_merge body: (BraceGroup children: [ (AndOr children: [ (C {(test_cmp)} {(DQ ($ VSub_Number '$2'))} {(DQ ($ VSub_Number '$1'))}) (AndOr children: [ (C {(git)} {(update-index)} {(--refresh)}) (AndOr children: [ (C {(git)} {(diff)} {(--exit-code)}) (If arms: [ (if_arm cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Number '$3'))})] action: [ (AndOr children: [ (SimpleCommand words: [ {(git)} {(show)} {(-s)} {(--pretty) (Lit_Other '=') (tformat) (Lit_Other ':') (Lit_Other '%') (s) } {(HEAD)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(msg.act)} spids: [584] ) ] ) (C {(test_cmp)} {(DQ ($ VSub_Number '$3'))} {(msg.act)}) ] op_id: Op_DAmp ) ] spids: [-1 566] ) ] spids: [-1 599] ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [521] ) spids: [516 520] ) (FuncDef name: verify_head body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$1'))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(head.expected)} spids:[618])] ) (AndOr children: [ (SimpleCommand words: [{(git)} {(rev-parse)} {(HEAD)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(head.actual)} spids: [630] ) ] ) (C {(test_cmp)} {(head.expected)} {(head.actual)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [609] ) spids: [604 608] ) (FuncDef name: verify_parents body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_At '$@'))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(parents.expected)} spids: [663] ) ] ) (AndOr children: [ (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(parents.actual)} spids: [669] ) ] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(1)} spids:[675])] spids: [675] ) (AndOr children: [ (While cond: [(C {(test)} {($ VSub_Name '$i')} {(-le)} {($ VSub_Pound '$#')})] body: (DoGroup children: [ (AndOr children: [ (SimpleCommand words: [ {(git)} {(rev-parse)} {(HEAD) (Lit_Other '^') ($ VSub_Name '$i')} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(parents.actual)} spids: [703] ) ] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:i) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(expr)} {($ VSub_Name '$i')} {(Lit_Other '+')} {(1)} ) ] ) left_token: <Left_CommandSub '$('> spids: [710 718] ) } spids: [709] ) ] spids: [709] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {(1)} ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) ] spids: [692 728] ) ) (AndOr children: [ (C {(test_must_fail)} {(git)} {(rev-parse)} {(--verify)} {(DQ ('HEAD^') ($ VSub_Name '$i'))} ) (C {(test_cmp)} {(parents.expected)} {(parents.actual)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [650] ) spids: [645 649] ) (FuncDef name: verify_mergeheads body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_At '$@'))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(mergehead.expected)} spids: [776] ) ] ) (AndOr children: [ (While cond: [(C {(read)} {(sha1)} {(rest)})] body: (DoGroup children: [(C {(git)} {(rev-parse)} {($ VSub_Name '$sha1')})] spids: [791 801] ) redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(.git/MERGE_HEAD)} spids: [803] ) (Redir op_id: Redir_Great fd: -1 arg_word: {(mergehead.actual)} spids: [806] ) ] ) (C {(test_cmp)} {(mergehead.expected)} {(mergehead.actual)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [763] ) spids: [758 762] ) (FuncDef name: verify_no_mergehead body: (BraceGroup children: [(Pipeline children:[(C {(test)} {(-e)} {(.git/MERGE_HEAD)})] negated:True)] spids: [826] ) spids: [821 825] ) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <'\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "commit 0" &&\n'> <'\tgit tag c0 &&\n'> <'\tc0=$(git rev-parse HEAD) &&\n'> <'\tcp file.1 file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "commit 1" &&\n'> <'\tgit tag c1 &&\n'> <'\tc1=$(git rev-parse HEAD) &&\n'> <'\tgit reset --hard "$c0" &&\n'> <'\tcp file.5 file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "commit 2" &&\n'> <'\tgit tag c2 &&\n'> <'\tc2=$(git rev-parse HEAD) &&\n'> <'\tgit reset --hard "$c0" &&\n'> <'\tcp file.9y file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "commit 7" &&\n'> <'\tgit tag c7 &&\n'> <'\tgit reset --hard "$c0" &&\n'> <'\tcp file.9 file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "commit 3" &&\n'> <'\tgit tag c3 &&\n'> <'\tc3=$(git rev-parse HEAD) &&\n'> <'\tgit reset --hard "$c0" &&\n'> <'\tcreate_merge_msgs\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'test option parsing'>)} { (SQ <'\n'> <'\ttest_must_fail git merge -$ c1 &&\n'> <'\ttest_must_fail git merge --no-such c1 &&\n'> <'\ttest_must_fail git merge -s foobar c1 &&\n'> <'\ttest_must_fail git merge -s=foobar c1 &&\n'> <'\ttest_must_fail git merge -m &&\n'> <'\ttest_must_fail git merge\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge -h with invalid index'>)} { (SQ <'\n'> <'\tmkdir broken &&\n'> <'\t(\n'> <'\t\tcd broken &&\n'> <'\t\tgit init &&\n'> <'\t\t>.git/index &&\n'> <'\t\ttest_expect_code 129 git merge -h 2>usage\n'> <'\t) &&\n'> <'\ttest_i18ngrep "[Uu]sage: git merge" broken/usage\n'> ) } ) (C {(test_expect_success)} {(SQ <'reject non-strategy with a git-merge-foo name'>)} {(SQ <'\n'> <'\ttest_must_fail git merge -s index c1\n'>)} ) (C {(test_expect_success)} {(SQ <'merge c0 with c1'>)} { (SQ <'\n'> <'\techo "OBJID HEAD@{0}: merge c1: Fast-forward" >reflog.expected &&\n'> <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head "$c1" &&\n'> <'\n'> <'\tgit reflog -1 >reflog.actual &&\n'> <'\tsed "s/$_x05[0-9a-f]*/OBJID/g" reflog.actual >reflog.fuzzy &&\n'> <'\ttest_cmp reflog.expected reflog.fuzzy\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c0 with c1 with --ff-only'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --ff-only c1 &&\n'> <'\tgit merge --ff-only HEAD c0 c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head "$c1"\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge from unborn branch'>)} { (SQ <'\n'> <'\tgit checkout -f master &&\n'> <'\ttest_might_fail git branch -D kid &&\n'> <'\n'> <'\techo "OBJID HEAD@{0}: initial pull" >reflog.expected &&\n'> <'\n'> <'\tgit checkout --orphan kid &&\n'> <'\ttest_when_finished "git checkout -f master" &&\n'> <'\tgit rm -fr . &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --ff-only c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head "$c1" &&\n'> <'\n'> <'\tgit reflog -1 >reflog.actual &&\n'> <'\tsed "s/$_x05[0-9a-f][0-9a-f]/OBJID/g" reflog.actual >reflog.fuzzy &&\n'> <'\ttest_cmp reflog.expected reflog.fuzzy\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_tick &&\n'> <'\tgit merge c2 &&\n'> <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge --squash c3 with c7'>)} { (SQ <'\n'> <'\tgit reset --hard c3 &&\n'> <'\ttest_must_fail git merge --squash c7 &&\n'> <'\tcat result.9z >file &&\n'> <'\tgit commit --no-edit -a &&\n'> <'\n'> <'\t{\n'> <'\t\tcat <<-EOF\n'> <'\t\tSquashed commit of the following:\n'> <'\n'> <'\t\t$(git show -s c7)\n'> <'\n'> <'\t\t# Conflicts:\n'> <'\t\t#\tfile\n'> <'\t\tEOF\n'> <'\t} >expect &&\n'> <'\tgit cat-file commit HEAD | sed -e '> ) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) (SQ <' >actual &&\n'> <'\ttest_cmp expect actual\n'>) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 and c3'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_tick &&\n'> <'\tgit merge c2 c3 &&\n'> <'\tverify_merge file result.1-5-9 msg.1-5-9 &&\n'> <'\tverify_parents $c1 $c2 $c3\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merges with --ff-only'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_tick &&\n'> <'\ttest_must_fail git merge --ff-only c2 &&\n'> <'\ttest_must_fail git merge --ff-only c3 &&\n'> <'\ttest_must_fail git merge --ff-only c2 c3 &&\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge c3 &&\n'> <'\tverify_head $c3\n'> ) } ) (C {(test_expect_success)} {(SQ <'merges with merge.ff=only'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_tick &&\n'> <'\ttest_config merge.ff "only" &&\n'> <'\ttest_must_fail git merge c2 &&\n'> <'\ttest_must_fail git merge c3 &&\n'> <'\ttest_must_fail git merge c2 c3 &&\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge c3 &&\n'> <'\tverify_head $c3\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge c0 with c1 (no-commit)'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --no-commit c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head $c1\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 (no-commit)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --no-commit c2 &&\n'> <'\tverify_merge file result.1-5 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_mergeheads $c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 and c3 (no-commit)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --no-commit c2 c3 &&\n'> <'\tverify_merge file result.1-5-9 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_mergeheads $c2 $c3\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c0 with c1 (squash)'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --squash c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head $c0 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1 .git/SQUASH_MSG\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c0 with c1 (squash, ff-only)'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --squash --ff-only c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head $c0 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1 .git/SQUASH_MSG\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 (squash)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --squash c2 &&\n'> <'\tverify_merge file result.1-5 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1-5 .git/SQUASH_MSG\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'unsuccessful merge of c1 with c2 (squash, ff-only)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_must_fail git merge --squash --ff-only c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 and c3 (squash)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --squash c2 c3 &&\n'> <'\tverify_merge file result.1-5-9 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1-5-9 .git/SQUASH_MSG\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 (no-commit in config)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_config branch.master.mergeoptions "--no-commit" &&\n'> <'\tgit merge c2 &&\n'> <'\tverify_merge file result.1-5 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_mergeheads $c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 (log in config)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge --log c2 &&\n'> <'\tgit show -s --pretty=tformat:%s%n%b >expect &&\n'> <'\n'> <'\ttest_config branch.master.mergeoptions "--log" &&\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge c2 &&\n'> <'\tgit show -s --pretty=tformat:%s%n%b >actual &&\n'> <'\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge c1 with c2 (log in config gets overridden)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge c2 &&\n'> <'\tgit show -s --pretty=tformat:%s%n%b >expect &&\n'> <'\n'> <'\ttest_config branch.master.mergeoptions "--no-log" &&\n'> <'\ttest_config merge.log "true" &&\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge c2 &&\n'> <'\tgit show -s --pretty=tformat:%s%n%b >actual &&\n'> <'\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge c1 with c2 (squash in config)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_config branch.master.mergeoptions "--squash" &&\n'> <'\tgit merge c2 &&\n'> <'\tverify_merge file result.1-5 &&\n'> <'\tverify_head $c1 &&\n'> <'\tverify_no_mergehead &&\n'> <'\ttest_cmp squash.1-5 .git/SQUASH_MSG\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'override config option -n with --summary'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_config branch.master.mergeoptions "-n" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --summary c2 >diffstat.txt &&\n'> <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2 &&\n'> <'\tif ! grep "^ file | *2 +-$" diffstat.txt\n'> <'\tthen\n'> <'\t\techo "[OOPS] diffstat was not generated with --summary"\n'> <'\t\tfalse\n'> <'\tfi\n'> ) } ) (C {(test_expect_success)} {(SQ <'override config option -n with --stat'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_config branch.master.mergeoptions "-n" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --stat c2 >diffstat.txt &&\n'> <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2 &&\n'> <'\tif ! grep "^ file | *2 +-$" diffstat.txt\n'> <'\tthen\n'> <'\t\techo "[OOPS] diffstat was not generated with --stat"\n'> <'\t\tfalse\n'> <'\tfi\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'override config option --stat'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_config branch.master.mergeoptions "--stat" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge -n c2 >diffstat.txt &&\n'> <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2 &&\n'> <'\tif grep "^ file | *2 +-$" diffstat.txt\n'> <'\tthen\n'> <'\t\techo "[OOPS] diffstat was generated"\n'> <'\t\tfalse\n'> <'\tfi\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 (override --no-commit)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_config branch.master.mergeoptions "--no-commit" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --commit c2 &&\n'> <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c2 (override --squash)'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\ttest_config branch.master.mergeoptions "--squash" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --no-squash c2 &&\n'> <'\tverify_merge file result.1-5 msg.1-5 &&\n'> <'\tverify_parents $c1 $c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c0 with c1 (no-ff)'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_tick &&\n'> <'\tgit merge --no-ff c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_parents $c0 $c1\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c0 with c1 (merge.ff=false)'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config merge.ff "false" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_parents $c0 $c1\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'combine branch.master.mergeoptions with merge.ff'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config branch.master.mergeoptions "--ff" &&\n'> <'\ttest_config merge.ff "false" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_parents "$c0"\n'> ) } ) (C {(test_expect_success)} {(SQ <'tolerate unknown values for merge.ff'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config merge.ff "something-new" &&\n'> <'\ttest_tick &&\n'> <'\tgit merge c1 2>message &&\n'> <'\tverify_head "$c1" &&\n'> <'\ttest_cmp empty message\n'> ) } ) (C {(test_expect_success)} {(SQ <'combining --squash and --no-ff is refused'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_must_fail git merge --squash --no-ff c1 &&\n'> <'\ttest_must_fail git merge --no-ff --squash c1\n'> ) } ) (C {(test_expect_success)} {(SQ <'option --ff-only overwrites --no-ff'>)} { (SQ <'\n'> <'\tgit merge --no-ff --ff-only c1 &&\n'> <'\ttest_must_fail git merge --no-ff --ff-only c2\n'> ) } ) (C {(test_expect_success)} {(SQ <'option --no-ff overrides merge.ff=only config'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config merge.ff only &&\n'> <'\tgit merge --no-ff c1\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge c0 with c1 (ff overrides no-ff)'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config branch.master.mergeoptions "--no-ff" &&\n'> <'\tgit merge --ff c1 &&\n'> <'\tverify_merge file result.1 &&\n'> <'\tverify_head $c1\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge log message'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --no-log c2 &&\n'> <'\tgit show -s --pretty=format:%b HEAD >msg.act &&\n'> <'\ttest_cmp msg.nologff msg.act &&\n'> <'\n'> <'\tgit reset --hard c0 &&\n'> <'\ttest_config branch.master.mergeoptions "--no-ff" &&\n'> <'\tgit merge --no-log c2 &&\n'> <'\tgit show -s --pretty=format:%b HEAD >msg.act &&\n'> <'\ttest_cmp msg.nolognoff msg.act &&\n'> <'\n'> <'\tgit merge --log c3 &&\n'> <'\tgit show -s --pretty=format:%b HEAD >msg.act &&\n'> <'\ttest_cmp msg.log msg.act &&\n'> <'\n'> <'\tgit reset --hard HEAD^ &&\n'> <'\ttest_config merge.log "yes" &&\n'> <'\tgit merge c3 &&\n'> <'\tgit show -s --pretty=format:%b HEAD >msg.act &&\n'> <'\ttest_cmp msg.log msg.act\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c0, c2, c0, and c1'>)} { (SQ <'\n'> <' git reset --hard c1 &&\n'> <' test_tick &&\n'> <' git merge c0 c2 c0 c1 &&\n'> <' verify_merge file result.1-5 &&\n'> <' verify_parents $c1 $c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c0, c2, c0, and c1'>)} { (SQ <'\n'> <' git reset --hard c1 &&\n'> <' test_tick &&\n'> <' git merge c0 c2 c0 c1 &&\n'> <' verify_merge file result.1-5 &&\n'> <' verify_parents $c1 $c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge c1 with c1 and c2'>)} { (SQ <'\n'> <' git reset --hard c1 &&\n'> <' test_tick &&\n'> <' git merge c1 c2 &&\n'> <' verify_merge file result.1-5 &&\n'> <' verify_parents $c1 $c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge fast-forward in a dirty tree'>)} { (SQ <'\n'> <' git reset --hard c0 &&\n'> <' mv file file1 &&\n'> <' cat file1 >file &&\n'> <' rm -f file1 &&\n'> <' git merge c2\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'in-index merge'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --no-ff -s resolve c1 >out &&\n'> <'\ttest_i18ngrep "Wonderful." out &&\n'> <'\tverify_parents $c0 $c1\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'refresh the index before merging'>)} { (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tcp file file.n && mv -f file.n file &&\n'> <'\tgit merge c3\n'> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected.branch)} spids:[1856]) (HereDoc op_id: Redir_DLess fd: -1 body: {("Merge branch 'c5-branch' (early part)\n")} do_expansion: False here_end: EOF was_filled: True spids: [1859] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected.tag)} spids:[1865]) (HereDoc op_id: Redir_DLess fd: -1 body: {("Merge commit 'c5~1'\n")} do_expansion: False here_end: EOF was_filled: True spids: [1868] ) ] ) (C {(test_expect_success)} {(SQ <'merge early part of c2'>)} { (SQ <'\n'> <'\tgit reset --hard c3 &&\n'> <'\techo c4 >c4.c &&\n'> <'\tgit add c4.c &&\n'> <'\tgit commit -m c4 &&\n'> <'\tgit tag c4 &&\n'> <'\techo c5 >c5.c &&\n'> <'\tgit add c5.c &&\n'> <'\tgit commit -m c5 &&\n'> <'\tgit tag c5 &&\n'> <'\tgit reset --hard c3 &&\n'> <'\techo c6 >c6.c &&\n'> <'\tgit add c6.c &&\n'> <'\tgit commit -m c6 &&\n'> <'\tgit tag c6 &&\n'> <'\tgit branch -f c5-branch c5 &&\n'> <'\tgit merge c5-branch~1 &&\n'> <'\tgit show -s --pretty=tformat:%s HEAD >actual.branch &&\n'> <'\tgit reset --keep HEAD^ &&\n'> <'\tgit merge c5~1 &&\n'> <'\tgit show -s --pretty=tformat:%s HEAD >actual.tag &&\n'> <'\ttest_cmp expected.branch actual.branch &&\n'> <'\ttest_cmp expected.tag actual.tag\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'merge --no-ff --no-commit && commit'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge --no-ff --no-commit c1 &&\n'> <'\tEDITOR=: git commit &&\n'> <'\tverify_parents $c0 $c1\n'> ) } ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (C {(test_expect_success)} {(SQ <'amending no-ff merge commit'>)} {(SQ <'\n'> <'\tEDITOR=: git commit --amend &&\n'> <'\tverify_parents $c0 $c1\n'>)} ) (C {(test_debug)} {(SQ <'git log --graph --decorate --oneline --all'>)}) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(editor)} spids:[1957]) (HereDoc op_id: Redir_DLess fd: -1 body: {('#!/bin/sh\n') ('# Add a new message string that was not in the template\n') ('(\n') ('\techo "Merge work done on the side branch c1"\n') ('\techo\n') ('\tcat <"$1"\n') (') >"$1.tmp" && mv "$1.tmp" "$1"\n') ('# strip comments and blank lines from end of message\n') ('sed -e \'/^#/d\' < "$1" | sed -e :a -e \'/^\\n*$/{$d;N;ba\' -e \'}\' > expected\n') } do_expansion: False here_end: EOF was_filled: True spids: [1960] ) ] ) (C {(chmod)} {(755)} {(editor)}) (C {(test_expect_success)} {(SQ <'merge --no-ff --edit'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tEDITOR=./editor git merge --no-ff --edit c1 &&\n'> <'\tverify_parents $c0 $c1 &&\n'> <'\tgit cat-file commit HEAD >raw &&\n'> <'\tgrep "work done on the side branch" raw &&\n'> <'\tsed "1,/^$/d" >actual raw &&\n'> <'\ttest_cmp actual expected\n'> ) } ) (C {(test_expect_success)} {(GPG)} {(SQ <'merge --ff-only tag'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit commit --allow-empty -m "A newer commit" &&\n'> <'\tgit tag -s -m "A newer commit" signed &&\n'> <'\tgit reset --hard c0 &&\n'> <'\n'> <'\tgit merge --ff-only signed &&\n'> <'\tgit rev-parse signed^0 >expect &&\n'> <'\tgit rev-parse HEAD >actual &&\n'> <'\ttest_cmp actual expect\n'> ) } ) (C {(test_expect_success)} {(GPG)} {(SQ <'merge --no-edit tag should skip editor'>)} { (SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit commit --allow-empty -m "A newer commit" &&\n'> <'\tgit tag -f -s -m "A newer commit" signed &&\n'> <'\tgit reset --hard c0 &&\n'> <'\n'> <'\tEDITOR=false git merge --no-edit signed &&\n'> <'\tgit rev-parse signed^0 >expect &&\n'> <'\tgit rev-parse HEAD^2 >actual &&\n'> <'\ttest_cmp actual expect\n'> ) } ) (C {(test_expect_success)} {(SQ <'set up mod-256 conflict scenario'>)} { (SQ <'\n'> <'\t# 256 near-identical stanzas...\n'> <'\tfor i in $(test_seq 1 256); do\n'> <'\t\tfor j in 1 2 3 4 5; do\n'> <'\t\t\techo $i-$j\n'> <'\t\tdone\n'> <'\tdone >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m base &&\n'> <'\n'> <'\t# one side changes the first line of each to "master"\n'> <'\tsed s/-1/-master/ <file >tmp &&\n'> <'\tmv tmp file &&\n'> <'\tgit commit -am master &&\n'> <'\n'> <'\t# and the other to "side"; merging the two will\n'> <'\t# yield 256 separate conflicts\n'> <'\tgit checkout -b side HEAD^ &&\n'> <'\tsed s/-1/-side/ <file >tmp &&\n'> <'\tmv tmp file &&\n'> <'\tgit commit -am side\n'> ) } ) (C {(test_expect_success)} {(SQ <'merge detects mod-256 conflicts (recursive)'>)} {(SQ <'\n'> <'\tgit reset --hard &&\n'> <'\ttest_must_fail git merge -s recursive master\n'>)} ) (C {(test_expect_success)} {(SQ <'merge detects mod-256 conflicts (resolve)'>)} {(SQ <'\n'> <'\tgit reset --hard &&\n'> <'\ttest_must_fail git merge -s resolve master\n'>)} ) (C {(test_expect_success)} {(SQ <'merge nothing into void'>)} { (SQ <'\n'> <'\tgit init void &&\n'> <'\t(\n'> <'\t\tcd void &&\n'> <'\t\tgit remote add up .. &&\n'> <'\t\tgit fetch up &&\n'> <'\t\ttest_must_fail git merge FETCH_HEAD\n'> <'\t)\n'> ) } ) (C {(test_done)}) ] )