X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7501-commit.sh;h=d2de57679f9ee347a5e77e751ae7767f9980f84e;hb=49ff9a7a02266a1b96e2236bc8f8d95e4b9507dd;hp=63bfc6d8b3f6917cad1b51a73a84ba61762b220d;hpb=bb11eb31a2e7da7f878dd501d39f6877ec00eb7d;p=git.git diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 63bfc6d8b..0166d35e5 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -38,7 +38,7 @@ test_expect_success \ "echo King of the bongo >file && test_must_fail git commit -m foo -a file" -test_expect_success \ +test_expect_success PERL \ "using paths with --interactive" \ "echo bong-o-bong >file && ! (echo 7 | git commit -m foo --interactive file)" @@ -86,7 +86,7 @@ chmod 755 editor test_expect_success \ "amend commit" \ - "VISUAL=./editor git commit --amend" + "EDITOR=./editor git commit --amend" test_expect_success \ "passing -m and -F" \ @@ -107,7 +107,7 @@ chmod 755 editor test_expect_success \ "editing message from other commit" \ "echo 'hula hula' >file && \ - VISUAL=./editor git commit -c HEAD^ -a" + EDITOR=./editor git commit -c HEAD^ -a" test_expect_success \ "message from stdin" \ @@ -117,9 +117,13 @@ test_expect_success \ test_expect_success \ "overriding author from command line" \ "echo 'gak' >file && \ - git commit -m 'author' --author 'Rubber Duck ' -a" + git commit -m 'author' --author 'Rubber Duck ' -a >output 2>&1" test_expect_success \ + "commit --author output mentions author" \ + "grep Rubber.Duck output" + +test_expect_success PERL \ "interactive add" \ "echo 7 | git commit --interactive | grep 'What now'" @@ -127,6 +131,26 @@ test_expect_success \ "showing committed revisions" \ "git rev-list HEAD >current" +cat >editor <<\EOF +#!/bin/sh +sed -e "s/good/bad/g" < "$1" > "$1-" +mv "$1-" "$1" +EOF +chmod 755 editor + +cat >msg <file && + EDITOR=./editor git commit -a -F msg && + git show -s --pretty=format:"%s" | grep -q good && + echo "quack" >file && + echo "Another good message." | EDITOR=./editor git commit -a -F - && + git show -s --pretty=format:"%s" | grep -q good + ' # We could just check the head sha1, but checking each commit makes it # easier to isolate bugs. @@ -227,6 +251,47 @@ $existing" && ' +test_expect_success 'signoff gap' ' + + echo 3 >positive && + git add positive && + alt="Alt-RFC-822-Header: Value" && + git commit -s -m "welcome + +$alt" && + git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && + ( + echo welcome + echo + echo $alt + git var GIT_COMMITTER_IDENT | + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" + ) >expected && + test_cmp expected actual +' + +test_expect_success 'signoff gap 2' ' + + echo 4 >positive && + git add positive && + alt="fixed: 34" && + git commit -s -m "welcome + +We have now +$alt" && + git cat-file commit HEAD | sed -e "1,/^\$/d" > actual && + ( + echo welcome + echo + echo We have now + echo $alt + echo + git var GIT_COMMITTER_IDENT | + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" + ) >expected && + test_cmp expected actual +' + test_expect_success 'multiple -m' ' >negative &&