(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'fmt-merge-msg test'>)} spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\techo one >one &&\n'> <'\tgit add one &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "Initial" &&\n'> <'\n'> <'\tgit clone . remote &&\n'> <'\n'> <'\techo uno >one &&\n'> <'\techo dos >two &&\n'> <'\tgit add two &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -a -m "Second" &&\n'> <'\n'> <'\tgit checkout -b left &&\n'> <'\n'> <'\techo "c1" >one &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -a -m "Common #1" &&\n'> <'\n'> <'\techo "c2" >one &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -a -m "Common #2" &&\n'> <'\n'> <'\tgit branch right &&\n'> <'\n'> <'\techo "l3" >two &&\n'> <'\ttest_tick &&\n'> <'\tGIT_COMMITTER_NAME="Another Committer" \\\n'> <'\tGIT_AUTHOR_NAME="Another Author" git commit -a -m "Left #3" &&\n'> <'\n'> <'\techo "l4" >two &&\n'> <'\ttest_tick &&\n'> <'\tGIT_COMMITTER_NAME="Another Committer" \\\n'> <'\tGIT_AUTHOR_NAME="Another Author" git commit -a -m "Left #4" &&\n'> <'\n'> <'\techo "l5" >two &&\n'> <'\ttest_tick &&\n'> <'\tGIT_COMMITTER_NAME="Another Committer" \\\n'> <'\tGIT_AUTHOR_NAME="Another Author" git commit -a -m "Left #5" &&\n'> <'\tgit tag tag-l5 &&\n'> <'\n'> <'\tgit checkout right &&\n'> <'\n'> <'\techo "r3" >three &&\n'> <'\tgit add three &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -a -m "Right #3" &&\n'> <'\tgit tag tag-r3 &&\n'> <'\n'> <'\techo "r4" >three &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -a -m "Right #4" &&\n'> <'\n'> <'\techo "r5" >three &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -a -m "Right #5" &&\n'> <'\n'> <'\tgit checkout -b long &&\n'> <'\ti=0 &&\n'> <'\twhile test $i -lt 30\n'> <'\tdo\n'> <'\t\ttest_commit $i one &&\n'> <'\t\ti=$(($i+1))\n'> <'\tdone &&\n'> <'\n'> <'\tgit show-branch &&\n'> <'\n'> <'\tapos="'> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <'"\n'>) } ) (C {<test_expect_success>} {(SQ <'message for merging local branch'>)} { (SQ <'\n'> <'\techo "Merge branch ${apos}left${apos}" >expected &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\tgit fetch . left &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'message for merging external branch'>)} { (SQ <'\n'> <'\techo "Merge branch ${apos}left${apos} of $(pwd)" >expected &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\tgit fetch "$(pwd)" left &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'[merge] summary/log configuration'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge branch ${apos}left${apos}\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* left:\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> <'\n'> <'\ttest_config merge.log true &&\n'> <'\ttest_unconfig merge.summary &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual1 &&\n'> <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary true &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual2 &&\n'> <'\n'> <'\ttest_cmp expected actual1 &&\n'> <'\ttest_cmp expected actual2\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup FETCH_HEAD'>)} {(SQ <'\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left\n'>)} ) (C {<test_expect_success>} {(SQ <'merge.log=3 limits shortlog length'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge branch ${apos}left${apos}\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* left: (5 commits)\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t ...\n'> <'\tEOF\n'> <'\n'> <'\tgit -c merge.log=3 fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge.log=5 shows all 5 commits'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge branch ${apos}left${apos}\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* left:\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> <'\n'> <'\tgit -c merge.log=5 fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--log=5 with custom comment character'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge branch ${apos}left${apos}\n'> <'\n'> <'\tx By Another Author (3) and A U Thor (2)\n'> <'\tx Via Another Committer\n'> <'\t* left:\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> <'\n'> <'\tgit -c core.commentchar="x" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge.log=0 disables shortlog'>)} { (SQ <'\n'> <'\techo "Merge branch ${apos}left${apos}" >expected &&\n'> <'\tgit -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--log=3 limits shortlog length'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge branch ${apos}left${apos}\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* left: (5 commits)\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t ...\n'> <'\tEOF\n'> <'\n'> <'\tgit fmt-merge-msg --log=3 <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--log=5 shows all 5 commits'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge branch ${apos}left${apos}\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* left:\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> <'\n'> <'\tgit fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--no-log disables shortlog'>)} { (SQ <'\n'> <'\techo "Merge branch ${apos}left${apos}" >expected &&\n'> <'\tgit fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--log=0 disables shortlog'>)} { (SQ <'\n'> <'\techo "Merge branch ${apos}left${apos}" >expected &&\n'> <'\tgit fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'fmt-merge-msg -m'>)} { (SQ <'\n'> <'\techo "Sync with left" >expected &&\n'> <'\tcat >expected.log <<-EOF &&\n'> <'\tSync with left\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* ${apos}left${apos} of $(pwd):\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_unconfig merge.summary &&\n'> <'\tgit checkout master &&\n'> <'\tgit fetch "$(pwd)" left &&\n'> <'\tgit fmt-merge-msg -m "Sync with left" <.git/FETCH_HEAD >actual &&\n'> <'\tgit fmt-merge-msg --log -m "Sync with left" \\\n'> <'\t\t\t\t\t<.git/FETCH_HEAD >actual.log &&\n'> <'\ttest_config merge.log true &&\n'> <'\tgit fmt-merge-msg -m "Sync with left" \\\n'> <'\t\t\t\t\t<.git/FETCH_HEAD >actual.log-config &&\n'> <'\tgit fmt-merge-msg --no-log -m "Sync with left" \\\n'> <'\t\t\t\t\t<.git/FETCH_HEAD >actual.nolog &&\n'> <'\n'> <'\ttest_cmp expected actual &&\n'> <'\ttest_cmp expected.log actual.log &&\n'> <'\ttest_cmp expected.log actual.log-config &&\n'> <'\ttest_cmp expected actual.nolog\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup: expected shortlog for two branches'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF\n'> <'\tMerge branches ${apos}left${apos} and ${apos}right${apos}\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* left:\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\n'> <'\t* right:\n'> <'\t Right #5\n'> <'\t Right #4\n'> <'\t Right #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'shortlog for two branches'>)} { (SQ <'\n'> <'\ttest_config merge.log true &&\n'> <'\ttest_unconfig merge.summary &&\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left right &&\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual1 &&\n'> <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary true &&\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left right &&\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual2 &&\n'> <'\n'> <'\ttest_config merge.log yes &&\n'> <'\ttest_unconfig merge.summary &&\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left right &&\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual3 &&\n'> <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary yes &&\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left right &&\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual4 &&\n'> <'\n'> <'\ttest_cmp expected actual1 &&\n'> <'\ttest_cmp expected actual2 &&\n'> <'\ttest_cmp expected actual3 &&\n'> <'\ttest_cmp expected actual4\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-msg -F'>)} { (SQ <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary yes &&\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left right &&\n'> <'\tgit fmt-merge-msg -F .git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-msg -F in subdirectory'>)} { (SQ <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary yes &&\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . left right &&\n'> <'\tmkdir sub &&\n'> <'\tcp .git/FETCH_HEAD sub/FETCH_HEAD &&\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\tgit fmt-merge-msg -F FETCH_HEAD >../actual\n'> <'\t) &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-msg with nothing to merge'>)} { (SQ <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary yes &&\n'> <'\n'> <'\t>empty &&\n'> <'\n'> <'\t(\n'> <'\t\tcd remote &&\n'> <'\t\tgit checkout -b unrelated &&\n'> <'\t\ttest_tick &&\n'> <'\t\tgit fetch origin &&\n'> <'\t\tgit fmt-merge-msg <.git/FETCH_HEAD >../actual\n'> <'\t) &&\n'> <'\n'> <'\ttest_cmp empty actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-msg tag'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge tag ${apos}tag-r3${apos}\n'> <'\n'> <'\t* tag ${apos}tag-r3${apos}:\n'> <'\t Right #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary yes &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . tag tag-r3 &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-msg two tags'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge tags ${apos}tag-r3${apos} and ${apos}tag-l5${apos}\n'> <'\n'> <'\t* tag ${apos}tag-r3${apos}:\n'> <'\t Right #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* tag ${apos}tag-l5${apos}:\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary yes &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . tag tag-r3 tag tag-l5 &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-msg tag and branch'>)} { (SQ <'\n'> <'\tcat >expected <<-EOF &&\n'> <'\tMerge branch ${apos}left${apos}, tag ${apos}tag-r3${apos}\n'> <'\n'> <'\t* tag ${apos}tag-r3${apos}:\n'> <'\t Right #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\n'> <'\t# By Another Author (3) and A U Thor (2)\n'> <'\t# Via Another Committer\n'> <'\t* left:\n'> <'\t Left #5\n'> <'\t Left #4\n'> <'\t Left #3\n'> <'\t Common #2\n'> <'\t Common #1\n'> <'\tEOF\n'> <'\n'> <'\ttest_unconfig merge.log &&\n'> <'\ttest_config merge.summary yes &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . tag tag-r3 left &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-msg lots of commits'>)} { (SQ <'\n'> <'\t{\n'> <'\t\tcat <<-EOF &&\n'> <'\t\tMerge branch ${apos}long${apos}\n'> <'\n'> <'\t\t* long: (35 commits)\n'> <'\t\tEOF\n'> <'\n'> <'\t\ti=29 &&\n'> <'\t\twhile test $i -gt 9\n'> <'\t\tdo\n'> <'\t\t\techo " $i" &&\n'> <'\t\t\ti=$(($i-1))\n'> <'\t\tdone &&\n'> <'\t\techo " ..."\n'> <'\t} >expected &&\n'> <'\n'> <'\ttest_config merge.summary yes &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\ttest_tick &&\n'> <'\tgit fetch . long &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge-msg with "merging" an annotated tag'>)} { (SQ <'\n'> <'\ttest_config merge.log true &&\n'> <'\n'> <'\tgit checkout master^0 &&\n'> <'\tgit commit --allow-empty -m "One step ahead" &&\n'> <'\tgit tag -a -m "An annotated one" annote HEAD &&\n'> <'\n'> <'\tgit checkout master &&\n'> <'\tgit fetch . annote &&\n'> <'\n'> <'\tgit fmt-merge-msg <.git/FETCH_HEAD >actual &&\n'> <'\t{\n'> <'\t\tcat <<-\\EOF\n'> <'\t\tMerge tag '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <annote>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <'\n'> <'\n'> <'\t\tAn annotated one\n'> <'\n'> <'\t\t* tag '>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <annote>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <':\n'> <'\t\t One step ahead\n'> <'\t\tEOF\n'> <'\t} >expected &&\n'> <'\ttest_cmp expected actual &&\n'> <'\n'> <'\ttest_when_finished "git reset --hard" &&\n'> <'\tannote=$(git rev-parse annote) &&\n'> <'\tgit merge --no-commit $annote &&\n'> <'\t{\n'> <'\t\tcat <<-EOF\n'> <'\t\tMerge tag '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <'$annote'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <'\n'> <'\n'> <'\t\tAn annotated one\n'> <'\n'> <'\t\t* tag '>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <'$annote'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <':\n'> <'\t\t One step ahead\n'> <'\t\tEOF\n'> <'\t} >expected &&\n'> <'\ttest_cmp expected .git/MERGE_MSG\n'> ) } ) (C {<test_done>}) ] )