(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_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] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/lib-gpg.sh'>}) (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {<9>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file>})] do_fork: T ) (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {<9>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file.1>})] do_fork: T ) (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {<1>} {<2>} {<3>} {<4>} {(SQ <'5 X'>)} {<6>} {<7>} {<8>} {<9>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file.5>})] do_fork: T ) (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {(SQ <'9 X'>)}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file.9>})] do_fork: T ) (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {(SQ <'9 Y'>)}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<file.9y>})] do_fork: T ) (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {<9>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<result.1>})] do_fork: T ) (command.Simple words: [ {<printf>} {(SQ <'%s\\n'>)} {(SQ <'1 X'>)} {<2>} {<3>} {<4>} {(SQ <'5 X'>)} {<6>} {<7>} {<8>} {<9>} ] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<result.1-5>})] do_fork: T ) (command.Simple 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 '>'> loc:(redir_loc.Fd fd:1) arg:{<result.1-5-9>})] do_fork: T ) (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {(SQ <'9 Z'>)}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<result.9z>})] do_fork: T ) (command.Simple redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<empty>})] do_fork: F ) (command.ShFunction name: create_merge_msgs body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<echo>} {(DQ <'Merge tag \'c2\''>)}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<msg.1-5>})] do_fork: T ) (command.Simple words: [{<echo>} {(DQ <'Merge tags \'c2\' and \'c3\''>)}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<msg.1-5-9>})] do_fork: T ) (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<echo>} {(DQ <'Squashed commit of the following:'>)}) (C {<echo>}) (C {<git>} {<log>} {<--no-merges>} {<Id.Lit_Other '^'> <HEAD>} {<c1>}) ] ) ] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<squash.1>})] ) (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<echo>} {(DQ <'Squashed commit of the following:'>)}) (C {<echo>}) (C {<git>} {<log>} {<--no-merges>} {<Id.Lit_Other '^'> <HEAD>} {<c2>}) ] ) ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<squash.1-5>} ) ] ) (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<echo>} {(DQ <'Squashed commit of the following:'>)}) (C {<echo>}) (C {<git>} {<log>} {<--no-merges>} {<Id.Lit_Other '^'> <HEAD>} {<c2>} {<c3>}) ] ) ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<squash.1-5-9>} ) ] ) (command.Simple words: [{<Id.Lit_Colon ':'>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<msg.nologff>} ) ] do_fork: T ) (command.Simple words: [{<Id.Lit_Colon ':'>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<msg.nolognoff>} ) ] do_fork: T ) (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [(C {<echo>} {(DQ <'* tag \'c3\':'>)}) (C {<echo>} {(DQ <' commit 3'>)})] ) ] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<msg.log>})] ) ] ) ] ) ) (command.ShFunction name: verify_merge body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<test_cmp>} {(DQ ($ Id.VSub_Number '$2'))} {(DQ ($ Id.VSub_Number '$1'))}) (C {<git>} {<update-index>} {<--refresh>}) (C {<git>} {<diff>} {<--exit-code>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [(C {<test>} {<-n>} {(DQ ($ Id.VSub_Number '$3'))})] ) action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [ {<git>} {<show>} {<-s>} {<--pretty> <Id.Lit_Equals '='> <tformat> <Id.Lit_Colon ':'> <Id.Lit_Other '%'> <s> } {<HEAD>} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<msg.act>} ) ] do_fork: T ) (C {<test_cmp>} {(DQ ($ Id.VSub_Number '$3'))} {<msg.act>}) ] ) ] spids: [555 566] ) ] ) ] ) ] ) ) (command.ShFunction name: verify_head body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_Number '$1'))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<head.expected>} ) ] do_fork: T ) (command.Simple words: [{<git>} {<rev-parse>} {<HEAD>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<head.actual>} ) ] do_fork: T ) (C {<test_cmp>} {<head.expected>} {<head.actual>}) ] ) ] ) ) (command.ShFunction name: verify_parents body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {(DQ ($ Id.VSub_At '$@'))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<parents.expected>} ) ] do_fork: T ) (command.Simple redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<parents.actual>} ) ] do_fork: F ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: {<1>} spids: [675] ) ] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (C {<test>} {($ Id.VSub_DollarName '$i')} {<-le>} {($ Id.VSub_Pound '$#')}) ] ) body: (command.DoGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DPipe] children: [ (command.Simple words: [ {<git>} {<rev-parse>} {<HEAD> <Id.Lit_Other '^'> ($ Id.VSub_DollarName '$i')} ] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {<parents.actual>} ) ] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<expr>} {($ Id.VSub_DollarName '$i')} {<Id.Lit_Other '+'>} {<1>} ) ) } spids: [709] ) ] ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] ) ] ) ) (C {<test_must_fail>} {<git>} {<rev-parse>} {<--verify>} {(DQ <'HEAD^'> ($ Id.VSub_DollarName '$i'))} ) (C {<test_cmp>} {<parents.expected>} {<parents.actual>}) ] ) ] ) ) (command.ShFunction name: verify_mergeheads body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<printf>} {(SQ <'%s\\n'>)} {(DQ ($ Id.VSub_At '$@'))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<mergehead.expected>} ) ] do_fork: T ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands:[(C {<read>} {<sha1>} {<rest>})]) body: (command.DoGroup children: [(C {<git>} {<rev-parse>} {($ Id.VSub_DollarName '$sha1')})] ) redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {<'.git/MERGE_HEAD'>} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<mergehead.actual>} ) ] ) (C {<test_cmp>} {<mergehead.expected>} {<mergehead.actual>}) ] ) ] ) ) (command.ShFunction name: verify_no_mergehead body: (BraceGroup children: [ (command.Pipeline children: [(C {<test>} {<-e>} {<'.git/MERGE_HEAD'>})] negated: T ) ] ) ) (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> <Id.Lit_Comma ','> <'/'> <Id.Lit_Other '^'> <Id.Lit_Dollar '$'> <'/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'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected.branch>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 1864 stdin_parts: [<'Merge branch \'c5-branch\' (early part)\n'>] ) ) ] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected.tag>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 1875 stdin_parts: [<'Merge commit \'c5~1\'\n'>] ) ) ] do_fork: T ) (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'>)}) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<editor>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 1977 stdin_parts: [ <'#!/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_fork: T ) (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>}) ] )