(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'git commit'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_DollarName '$TEST_DIRECTORY') (/diff-lib.sh))}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:author) op: Equal rhs: {(SQ <'The Real Author <someguy@his.email.org>'>)} ) ] ) (C {(test_tick)}) (C {(test_expect_success)} {(SQ <'initial status'>)} { (SQ <'\n'> <'\techo bongo bongo >file &&\n'> <'\tgit add file &&\n'> <'\tgit status >actual &&\n'> <'\ttest_i18ngrep "Initial commit" actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'fail initial amend'>)} {(SQ <'\n'> <'\ttest_must_fail git commit --amend\n'>)} ) (C {(test_expect_success)} {(SQ <'setup: initial commit'>)} {(SQ <'\n'> <'\tgit commit -m initial\n'>)} ) (C {(test_expect_success)} {(SQ <'-m and -F do not mix'>)} { (SQ <'\n'> <'\tgit checkout HEAD file && echo >>file && git add file &&\n'> <'\ttest_must_fail git commit -m foo -m bar -F file\n'> ) } ) (C {(test_expect_success)} {(SQ <'-m and -C do not mix'>)} { (SQ <'\n'> <'\tgit checkout HEAD file && echo >>file && git add file &&\n'> <'\ttest_must_fail git commit -C HEAD -m illegal\n'> ) } ) (C {(test_expect_success)} {(SQ <'paths and -a do not mix'>)} { (SQ <'\n'> <'\techo King of the bongo >file &&\n'> <'\ttest_must_fail git commit -m foo -a file\n'> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <'can use paths with --interactive'>)} { (SQ <'\n'> <'\techo bong-o-bong >file &&\n'> <'\t# 2: update, 1:st path, that is all, 7: quit\n'> <'\t( echo 2; echo 1; echo; echo 7 ) |\n'> <'\tgit commit -m foo --interactive file &&\n'> <'\tgit reset --hard HEAD^\n'> ) } ) (C {(test_expect_success)} {(SQ <'using invalid commit with -C'>)} {(SQ <'\n'> <'\ttest_must_fail git commit --allow-empty -C bogus\n'>)} ) (C {(test_expect_success)} {(SQ <'nothing to commit'>)} {(SQ <'\n'> <'\tgit reset --hard &&\n'> <'\ttest_must_fail git commit -m initial\n'>)} ) (C {(test_expect_success)} {(SQ <'--dry-run fails with nothing to commit'>)} {(SQ <'\n'> <'\ttest_must_fail git commit -m initial --dry-run\n'>)} ) (C {(test_expect_success)} {(SQ <'--short fails with nothing to commit'>)} {(SQ <'\n'> <'\ttest_must_fail git commit -m initial --short\n'>)} ) (C {(test_expect_success)} {(SQ <'--porcelain fails with nothing to commit'>)} {(SQ <'\n'> <'\ttest_must_fail git commit -m initial --porcelain\n'>)} ) (C {(test_expect_success)} {(SQ <'--long fails with nothing to commit'>)} {(SQ <'\n'> <'\ttest_must_fail git commit -m initial --long\n'>)} ) (C {(test_expect_success)} {(SQ <'setup: non-initial commit'>)} {(SQ <'\n'> <'\techo bongo bongo bongo >file &&\n'> <'\tgit commit -m next -a\n'>)} ) (C {(test_expect_success)} {(SQ <'--dry-run with stuff to commit returns ok'>)} {(SQ <'\n'> <'\techo bongo bongo bongo >>file &&\n'> <'\tgit commit -m next -a --dry-run\n'>)} ) (C {(test_expect_failure)} {(SQ <'--short with stuff to commit returns ok'>)} {(SQ <'\n'> <'\techo bongo bongo bongo >>file &&\n'> <'\tgit commit -m next -a --short\n'>)} ) (C {(test_expect_failure)} {(SQ <'--porcelain with stuff to commit returns ok'>)} {(SQ <'\n'> <'\techo bongo bongo bongo >>file &&\n'> <'\tgit commit -m next -a --porcelain\n'>)} ) (C {(test_expect_success)} {(SQ <'--long with stuff to commit returns ok'>)} {(SQ <'\n'> <'\techo bongo bongo bongo >>file &&\n'> <'\tgit commit -m next -a --long\n'>)} ) (C {(test_expect_success)} {(SQ <'commit message from non-existing file'>)} { (SQ <'\n'> <'\techo more bongo: bongo bongo bongo bongo >file &&\n'> <'\ttest_must_fail git commit -F gah -a\n'> ) } ) (C {(test_expect_success)} {(SQ <'empty commit message'>)} { (SQ <'\n'> <'\t# Empty except stray tabs and spaces on a few lines.\n'> <'\tsed -e "s/@//g" >msg <<-\\EOF &&\n'> <'\t\t@\t\t@\n'> <'\t\t@@\n'> <'\t\t@ @\n'> <'\t\t@Signed-off-by: hula@\n'> <'\tEOF\n'> <'\ttest_must_fail git commit -F msg -a\n'> ) } ) (C {(test_expect_success)} {(SQ <'template "emptyness" check does not kick in with -F'>)} { (SQ <'\n'> <'\tgit checkout HEAD file && echo >>file && git add file &&\n'> <'\tgit commit -t file -F file\n'> ) } ) (C {(test_expect_success)} {(SQ <'template "emptyness" check'>)} { (SQ <'\n'> <'\tgit checkout HEAD file && echo >>file && git add file &&\n'> <'\ttest_must_fail git commit -t file 2>err &&\n'> <'\ttest_i18ngrep "did not edit" err\n'> ) } ) (C {(test_expect_success)} {(SQ <'setup: commit message from file'>)} { (SQ <'\n'> <'\tgit checkout HEAD file && echo >>file && git add file &&\n'> <'\techo this is the commit message, coming from a file >msg &&\n'> <'\tgit commit -F msg -a\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend commit'>)} { (SQ <'\n'> <'\tcat >editor <<-\\EOF &&\n'> <'\t#!/bin/sh\n'> <'\tsed -e "s/a file/an amend commit/g" < "$1" > "$1-"\n'> <'\tmv "$1-" "$1"\n'> <'\tEOF\n'> <'\tchmod 755 editor &&\n'> <'\tEDITOR=./editor git commit --amend\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend --only ignores staged contents'>)} { (SQ <'\n'> <'\tcp file file.expect &&\n'> <'\techo changed >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit --no-edit --amend --only &&\n'> <'\tgit cat-file blob HEAD:file >file.actual &&\n'> <'\ttest_cmp file.expect file.actual &&\n'> <'\tgit diff --exit-code\n'> ) } ) (C {(test_expect_success)} {(SQ <'set up editor'>)} { (SQ <'\n'> <'\tcat >editor <<-\\EOF &&\n'> <'\t#!/bin/sh\n'> <'\tsed -e "s/unamended/amended/g" <"$1" >"$1-"\n'> <'\tmv "$1-" "$1"\n'> <'\tEOF\n'> <'\tchmod 755 editor\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend without launching editor'>)} { (SQ <'\n'> <'\techo unamended >expect &&\n'> <'\tgit commit --allow-empty -m "unamended" &&\n'> <'\techo needs more bongo >file &&\n'> <'\tgit add file &&\n'> <'\tEDITOR=./editor git commit --no-edit --amend &&\n'> <'\tgit diff --exit-code HEAD -- file &&\n'> <'\tgit diff-tree -s --format=%s HEAD >msg &&\n'> <'\ttest_cmp expect msg\n'> ) } ) (C {(test_expect_success)} {(SQ <'--amend --edit'>)} { (SQ <'\n'> <'\techo amended >expect &&\n'> <'\tgit commit --allow-empty -m "unamended" &&\n'> <'\techo bongo again >file &&\n'> <'\tgit add file &&\n'> <'\tEDITOR=./editor git commit --edit --amend &&\n'> <'\tgit diff-tree -s --format=%s HEAD >msg &&\n'> <'\ttest_cmp expect msg\n'> ) } ) (C {(test_expect_success)} {(SQ <'--amend --edit of empty message'>)} { (SQ <'\n'> <'\tcat >replace <<-\\EOF &&\n'> <'\t#!/bin/sh\n'> <'\techo "amended" >"$1"\n'> <'\tEOF\n'> <'\tchmod 755 replace &&\n'> <'\tgit commit --allow-empty --allow-empty-message -m "" &&\n'> <'\techo more bongo >file &&\n'> <'\tgit add file &&\n'> <'\tEDITOR=./replace git commit --edit --amend &&\n'> <'\tgit diff-tree -s --format=%s HEAD >msg &&\n'> <'\t./replace expect &&\n'> <'\ttest_cmp expect msg\n'> ) } ) (C {(test_expect_success)} {(SQ <'--amend to set message to empty'>)} { (SQ <'\n'> <'\techo bata >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m "unamended" &&\n'> <'\tgit commit --amend --allow-empty-message -m "" &&\n'> <'\tgit diff-tree -s --format=%s HEAD >msg &&\n'> <'\techo "" >expect &&\n'> <'\ttest_cmp expect msg\n'> ) } ) (C {(test_expect_success)} {(SQ <'--amend to set empty message needs --allow-empty-message'>)} { (SQ <'\n'> <'\techo conga >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m "unamended" &&\n'> <'\ttest_must_fail git commit --amend -m "" &&\n'> <'\tgit diff-tree -s --format=%s HEAD >msg &&\n'> <'\techo "unamended" >expect &&\n'> <'\ttest_cmp expect msg\n'> ) } ) (C {(test_expect_success)} {(SQ <'-m --edit'>)} { (SQ <'\n'> <'\techo amended >expect &&\n'> <'\tgit commit --allow-empty -m buffer &&\n'> <'\techo bongo bongo >file &&\n'> <'\tgit add file &&\n'> <'\tEDITOR=./editor git commit -m unamended --edit &&\n'> <'\tgit diff-tree -s --format=%s HEAD >msg &&\n'> <'\ttest_cmp expect msg\n'> ) } ) (C {(test_expect_success)} {(SQ <'-m and -F do not mix'>)} { (SQ <'\n'> <'\techo enough with the bongos >file &&\n'> <'\ttest_must_fail git commit -F msg -m amending .\n'> ) } ) (C {(test_expect_success)} {(SQ <'using message from other commit'>)} {(SQ <'\n'> <'\tgit commit -C HEAD^ .\n'>)} ) (C {(test_expect_success)} {(SQ <'editing message from other commit'>)} { (SQ <'\n'> <'\tcat >editor <<-\\EOF &&\n'> <'\t#!/bin/sh\n'> <'\tsed -e "s/amend/older/g" < "$1" > "$1-"\n'> <'\tmv "$1-" "$1"\n'> <'\tEOF\n'> <'\tchmod 755 editor &&\n'> <'\techo hula hula >file &&\n'> <'\tEDITOR=./editor git commit -c HEAD^ -a\n'> ) } ) (C {(test_expect_success)} {(SQ <'message from stdin'>)} { (SQ <'\n'> <'\techo silly new contents >file &&\n'> <'\techo commit message from stdin |\n'> <'\tgit commit -F - -a\n'> ) } ) (C {(test_expect_success)} {(SQ <'overriding author from command line'>)} { (SQ <'\n'> <'\techo gak >file &&\n'> <'\tgit commit -m author \\\n'> <'\t\t--author "Rubber Duck <rduck@convoy.org>" -a >output 2>&1 &&\n'> <'\tgrep Rubber.Duck output\n'> ) } ) (C {(test_expect_success)} {(PERL)} {(SQ <'interactive add'>)} {(SQ <'\n'> <'\techo 7 |\n'> <'\tgit commit --interactive |\n'> <'\tgrep "What now"\n'>)} ) (C {(test_expect_success)} {(PERL)} {(DQ ("commit --interactive doesn't change index if editor aborts"))} { (SQ <'\n'> <'\techo zoo >file &&\n'> <'\ttest_must_fail git diff --exit-code >diff1 &&\n'> <'\t(echo u ; echo "*" ; echo q) |\n'> <'\t(\n'> <'\t\tEDITOR=: &&\n'> <'\t\texport EDITOR &&\n'> <'\t\ttest_must_fail git commit --interactive\n'> <'\t) &&\n'> <'\tgit diff >diff2 &&\n'> <'\tcompare_diff_patch diff1 diff2\n'> ) } ) (C {(test_expect_success)} {(SQ <'editor not invoked if -F is given'>)} { (SQ <'\n'> <'\tcat >editor <<-\\EOF &&\n'> <'\t#!/bin/sh\n'> <'\tsed -e s/good/bad/g <"$1" >"$1-"\n'> <'\tmv "$1-" "$1"\n'> <'\tEOF\n'> <'\tchmod 755 editor &&\n'> <'\n'> <'\techo A good commit message. >msg &&\n'> <'\techo moo >file &&\n'> <'\n'> <'\tEDITOR=./editor git commit -a -F msg &&\n'> <'\tgit show -s --pretty=format:%s >subject &&\n'> <'\tgrep -q good subject &&\n'> <'\n'> <'\techo quack >file &&\n'> <'\techo Another good message. |\n'> <'\tEDITOR=./editor git commit -a -F - &&\n'> <'\tgit show -s --pretty=format:%s >subject &&\n'> <'\tgrep -q good subject\n'> ) } ) (C {(test_expect_success)} {(SQ <'partial commit that involves removal (1)'>)} { (SQ <'\n'> <'\n'> <'\tgit rm --cached file &&\n'> <'\tmv file elif &&\n'> <'\tgit add elif &&\n'> <'\tgit commit -m "Partial: add elif" elif &&\n'> <'\tgit diff-tree --name-status HEAD^ HEAD >current &&\n'> <'\techo "A\telif" >expected &&\n'> <'\ttest_cmp expected current\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'partial commit that involves removal (2)'>)} { (SQ <'\n'> <'\n'> <'\tgit commit -m "Partial: remove file" file &&\n'> <'\tgit diff-tree --name-status HEAD^ HEAD >current &&\n'> <'\techo "D\tfile" >expected &&\n'> <'\ttest_cmp expected current\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'partial commit that involves removal (3)'>)} { (SQ <'\n'> <'\n'> <'\tgit rm --cached elif &&\n'> <'\techo elif >elif &&\n'> <'\tgit commit -m "Partial: modify elif" elif &&\n'> <'\tgit diff-tree --name-status HEAD^ HEAD >current &&\n'> <'\techo "M\telif" >expected &&\n'> <'\ttest_cmp expected current\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend commit to fix author'>)} { (SQ <'\n'> <'\n'> <'\toldtick=$GIT_AUTHOR_DATE &&\n'> <'\ttest_tick &&\n'> <'\tgit reset --hard &&\n'> <'\tgit cat-file -p HEAD |\n'> <'\tsed -e "s/author.*/author $author $oldtick/" \\\n'> <'\t\t-e "s/^\\(committer.*> \\).*$/\\1$GIT_COMMITTER_DATE/" > \\\n'> <'\t\texpected &&\n'> <'\tgit commit --amend --author="$author" &&\n'> <'\tgit cat-file -p HEAD > current &&\n'> <'\ttest_cmp expected current\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend commit to fix date'>)} { (SQ <'\n'> <'\n'> <'\ttest_tick &&\n'> <'\tnewtick=$GIT_AUTHOR_DATE &&\n'> <'\tgit reset --hard &&\n'> <'\tgit cat-file -p HEAD |\n'> <'\tsed -e "s/author.*/author $author $newtick/" \\\n'> <'\t\t-e "s/^\\(committer.*> \\).*$/\\1$GIT_COMMITTER_DATE/" > \\\n'> <'\t\texpected &&\n'> <'\tgit commit --amend --date="$newtick" &&\n'> <'\tgit cat-file -p HEAD > current &&\n'> <'\ttest_cmp expected current\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'commit mentions forced date in output'>)} { (SQ <'\n'> <'\tgit commit --amend --date=2010-01-02T03:04:05 >output &&\n'> <'\tgrep "Date: *Sat Jan 2 03:04:05 2010" output\n'> ) } ) (C {(test_expect_success)} {(SQ <'commit complains about completely bogus dates'>)} {(SQ <'\n'> <'\ttest_must_fail git commit --amend --date=seventeen\n'>)} ) (C {(test_expect_success)} {(SQ <'commit --date allows approxidate'>)} { (SQ <'\n'> <'\tgit commit --amend \\\n'> <'\t\t--date="midnight the 12th of october, anno domini 1979" &&\n'> <'\techo "Fri Oct 12 00:00:00 1979 +0000" >expect &&\n'> <'\tgit log -1 --format=%ad >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'sign off (1)'>)} { (SQ <'\n'> <'\n'> <'\techo 1 >positive &&\n'> <'\tgit add positive &&\n'> <'\tgit commit -s -m "thank you" &&\n'> <'\tgit cat-file commit HEAD | sed -e "1,/^\\$/d" >actual &&\n'> <'\t(\n'> <'\t\techo thank you\n'> <'\t\techo\n'> <'\t\tgit var GIT_COMMITTER_IDENT |\n'> <'\t\tsed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"\n'> <'\t) >expected &&\n'> <'\ttest_cmp expected actual\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'sign off (2)'>)} { (SQ <'\n'> <'\n'> <'\techo 2 >positive &&\n'> <'\tgit add positive &&\n'> <'\texisting="Signed-off-by: Watch This <watchthis@example.com>" &&\n'> <'\tgit commit -s -m "thank you\n'> <'\n'> <'$existing" &&\n'> <'\tgit cat-file commit HEAD | sed -e "1,/^\\$/d" >actual &&\n'> <'\t(\n'> <'\t\techo thank you\n'> <'\t\techo\n'> <'\t\techo $existing\n'> <'\t\tgit var GIT_COMMITTER_IDENT |\n'> <'\t\tsed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"\n'> <'\t) >expected &&\n'> <'\ttest_cmp expected actual\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'signoff gap'>)} { (SQ <'\n'> <'\n'> <'\techo 3 >positive &&\n'> <'\tgit add positive &&\n'> <'\talt="Alt-RFC-822-Header: Value" &&\n'> <'\tgit commit -s -m "welcome\n'> <'\n'> <'$alt" &&\n'> <'\tgit cat-file commit HEAD | sed -e "1,/^\\$/d" > actual &&\n'> <'\t(\n'> <'\t\techo welcome\n'> <'\t\techo\n'> <'\t\techo $alt\n'> <'\t\tgit var GIT_COMMITTER_IDENT |\n'> <'\t\tsed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"\n'> <'\t) >expected &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'signoff gap 2'>)} { (SQ <'\n'> <'\n'> <'\techo 4 >positive &&\n'> <'\tgit add positive &&\n'> <'\talt="fixed: 34" &&\n'> <'\tgit commit -s -m "welcome\n'> <'\n'> <'We have now\n'> <'$alt" &&\n'> <'\tgit cat-file commit HEAD | sed -e "1,/^\\$/d" > actual &&\n'> <'\t(\n'> <'\t\techo welcome\n'> <'\t\techo\n'> <'\t\techo We have now\n'> <'\t\techo $alt\n'> <'\t\techo\n'> <'\t\tgit var GIT_COMMITTER_IDENT |\n'> <'\t\tsed -e "s/>.*/>/" -e "s/^/Signed-off-by: /"\n'> <'\t) >expected &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'multiple -m'>)} { (SQ <'\n'> <'\n'> <'\t>negative &&\n'> <'\tgit add negative &&\n'> <'\tgit commit -m "one" -m "two" -m "three" &&\n'> <'\tgit cat-file commit HEAD | sed -e "1,/^\\$/d" >actual &&\n'> <'\t(\n'> <'\t\techo one\n'> <'\t\techo\n'> <'\t\techo two\n'> <'\t\techo\n'> <'\t\techo three\n'> <'\t) >expected &&\n'> <'\ttest_cmp expected actual\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend commit to fix author'>)} { (SQ <'\n'> <'\n'> <'\toldtick=$GIT_AUTHOR_DATE &&\n'> <'\ttest_tick &&\n'> <'\tgit reset --hard &&\n'> <'\tgit cat-file -p HEAD |\n'> <'\tsed -e "s/author.*/author $author $oldtick/" \\\n'> <'\t\t-e "s/^\\(committer.*> \\).*$/\\1$GIT_COMMITTER_DATE/" > \\\n'> <'\t\texpected &&\n'> <'\tgit commit --amend --author="$author" &&\n'> <'\tgit cat-file -p HEAD > current &&\n'> <'\ttest_cmp expected current\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'git commit <file> with dirty index'>)} { (SQ <'\n'> <'\techo tacocat > elif &&\n'> <'\techo tehlulz > chz &&\n'> <'\tgit add chz &&\n'> <'\tgit commit elif -m "tacocat is a palindrome" &&\n'> <'\tgit show --stat | grep elif &&\n'> <'\tgit diff --cached | grep chz\n'> ) } ) (C {(test_expect_success)} {(SQ <'same tree (single parent)'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\ttest_must_fail git commit -m empty\n'> <'\n'>) } ) (C {(test_expect_success)} {(SQ <'same tree (single parent) --allow-empty'>)} { (SQ <'\n'> <'\n'> <'\tgit commit --allow-empty -m "forced empty" &&\n'> <'\tgit cat-file commit HEAD | grep forced\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'same tree (merge and amend merge)'>)} { (SQ <'\n'> <'\n'> <'\tgit checkout -b side HEAD^ &&\n'> <'\techo zero >zero &&\n'> <'\tgit add zero &&\n'> <'\tgit commit -m "add zero" &&\n'> <'\tgit checkout master &&\n'> <'\n'> <'\tgit merge -s ours side -m "empty ok" &&\n'> <'\tgit diff HEAD^ HEAD >actual &&\n'> <'\t: >expected &&\n'> <'\ttest_cmp expected actual &&\n'> <'\n'> <'\tgit commit --amend -m "empty really ok" &&\n'> <'\tgit diff HEAD^ HEAD >actual &&\n'> <'\t: >expected &&\n'> <'\ttest_cmp expected actual\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend using the message from another commit'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m "old commit" &&\n'> <'\told=$(git rev-parse --verify HEAD) &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m "new commit" &&\n'> <'\tnew=$(git rev-parse --verify HEAD) &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty --amend -C "$old" &&\n'> <'\tgit show --pretty="format:%ad %s" "$old" >expected &&\n'> <'\tgit show --pretty="format:%ad %s" HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend using the message from a commit named with tag'>)} { (SQ <'\n'> <'\n'> <'\tgit reset --hard &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m "old commit" &&\n'> <'\told=$(git rev-parse --verify HEAD) &&\n'> <'\tgit tag -a -m "tag on old" tagged-old HEAD &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty -m "new commit" &&\n'> <'\tnew=$(git rev-parse --verify HEAD) &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --allow-empty --amend -C tagged-old &&\n'> <'\tgit show --pretty="format:%ad %s" "$old" >expected &&\n'> <'\tgit show --pretty="format:%ad %s" HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'amend can copy notes'>)} { (SQ <'\n'> <'\n'> <'\tgit config notes.rewrite.amend true &&\n'> <'\tgit config notes.rewriteRef "refs/notes/*" &&\n'> <'\ttest_commit foo &&\n'> <'\tgit notes add -m"a note" &&\n'> <'\ttest_tick &&\n'> <'\tgit commit --amend -m"new foo" &&\n'> <'\ttest "$(git notes show)" = "a note"\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'commit a file whose name is a dash'>)} { (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tfor i in 1 2 3 4 5\n'> <'\tdo\n'> <'\t\techo $i\n'> <'\tdone >./- &&\n'> <'\tgit add ./- &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "add dash" >output </dev/null &&\n'> <'\ttest_i18ngrep " changed, 5 insertions" output\n'> ) } ) (C {(test_expect_success)} {(SQ <'--only works on to-be-born branch'>)} { (SQ <'\n'> <'\t# This test relies on having something in the index, as it\n'> <'\t# would not otherwise actually prove much. So check this.\n'> <'\ttest -n "$(git ls-files)" &&\n'> <'\tgit checkout --orphan orphan &&\n'> <'\techo foo >newfile &&\n'> <'\tgit add newfile &&\n'> <'\tgit commit --only newfile -m"--only on unborn branch" &&\n'> <'\techo newfile >expected &&\n'> <'\tgit ls-tree -r --name-only HEAD >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'--dry-run with conflicts fixed from a merge'>)} { (SQ <'\n'> <'\t# setup two branches with conflicting information\n'> <'\t# in the same file, resolve the conflict,\n'> <'\t# call commit with --dry-run\n'> <'\techo "Initial contents, unimportant" >test-file &&\n'> <'\tgit add test-file &&\n'> <'\tgit commit -m "Initial commit" &&\n'> <'\techo "commit-1-state" >test-file &&\n'> <'\tgit commit -m "commit 1" -i test-file &&\n'> <'\tgit tag commit-1 &&\n'> <'\tgit checkout -b branch-2 HEAD^1 &&\n'> <'\techo "commit-2-state" >test-file &&\n'> <'\tgit commit -m "commit 2" -i test-file &&\n'> <'\t! $(git merge --no-commit commit-1) &&\n'> <'\techo "commit-2-state" >test-file &&\n'> <'\tgit add test-file &&\n'> <'\tgit commit --dry-run &&\n'> <'\tgit commit -m "conflicts fixed from merge."\n'> ) } ) (C {(test_done)}) ] )