X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft4014-format-patch.sh;h=3bc1cccf8869aef26e175e207dc2923d3ddb1e65;hb=5d4bd79d8002ee199c6561b2a10466c347caf2fa;hp=cab6ce2e97b2439730915c12b5b141e634e759c5;hpb=ef6a243e9518938e9efd3941a6e5eace3fc66081;p=git.git diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index cab6ce2e9..843ef7f88 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -93,9 +93,9 @@ test_expect_success 'extra headers' ' git config --add format.headers "Cc: S. E. Cipient " && git format-patch --stdout master..side > patch2 && - sed -e "/^$/q" patch2 > hdrs2 && - grep "^To: R. E. Cipient $" hdrs2 && - grep "^Cc: S. E. Cipient $" hdrs2 + sed -e "/^\$/q" patch2 > hdrs2 && + grep "^To: R. E. Cipient \$" hdrs2 && + grep "^Cc: S. E. Cipient \$" hdrs2 ' @@ -104,9 +104,9 @@ test_expect_success 'extra headers without newlines' ' git config --replace-all format.headers "To: R. E. Cipient " && git config --add format.headers "Cc: S. E. Cipient " && git format-patch --stdout master..side >patch3 && - sed -e "/^$/q" patch3 > hdrs3 && - grep "^To: R. E. Cipient $" hdrs3 && - grep "^Cc: S. E. Cipient $" hdrs3 + sed -e "/^\$/q" patch3 > hdrs3 && + grep "^To: R. E. Cipient \$" hdrs3 && + grep "^Cc: S. E. Cipient \$" hdrs3 ' @@ -115,32 +115,32 @@ test_expect_success 'extra headers with multiple To:s' ' git config --replace-all format.headers "To: R. E. Cipient " && git config --add format.headers "To: S. E. Cipient " && git format-patch --stdout master..side > patch4 && - sed -e "/^$/q" patch4 > hdrs4 && - grep "^To: R. E. Cipient ,$" hdrs4 && - grep "^ *S. E. Cipient $" hdrs4 + sed -e "/^\$/q" patch4 > hdrs4 && + grep "^To: R. E. Cipient ,\$" hdrs4 && + grep "^ *S. E. Cipient \$" hdrs4 ' test_expect_success 'additional command line cc' ' git config --replace-all format.headers "Cc: R. E. Cipient " && - git format-patch --cc="S. E. Cipient " --stdout master..side | sed -e "/^$/q" >patch5 && - grep "^Cc: R. E. Cipient ,$" patch5 && - grep "^ *S. E. Cipient $" patch5 + git format-patch --cc="S. E. Cipient " --stdout master..side | sed -e "/^\$/q" >patch5 && + grep "^Cc: R. E. Cipient ,\$" patch5 && + grep "^ *S. E. Cipient \$" patch5 ' test_expect_success 'command line headers' ' git config --unset-all format.headers && - git format-patch --add-header="Cc: R. E. Cipient " --stdout master..side | sed -e "/^$/q" >patch6 && - grep "^Cc: R. E. Cipient $" patch6 + git format-patch --add-header="Cc: R. E. Cipient " --stdout master..side | sed -e "/^\$/q" >patch6 && + grep "^Cc: R. E. Cipient \$" patch6 ' test_expect_success 'configuration headers and command line headers' ' git config --replace-all format.headers "Cc: R. E. Cipient " && - git format-patch --add-header="Cc: S. E. Cipient " --stdout master..side | sed -e "/^$/q" >patch7 && - grep "^Cc: R. E. Cipient ,$" patch7 && - grep "^ *S. E. Cipient $" patch7 + git format-patch --add-header="Cc: S. E. Cipient " --stdout master..side | sed -e "/^\$/q" >patch7 && + grep "^Cc: R. E. Cipient ,\$" patch7 && + grep "^ *S. E. Cipient \$" patch7 ' test_expect_success 'multiple files' ' @@ -406,9 +406,9 @@ test_expect_success 'cover-letter inherits diff options' ' git mv file foo && git commit -m foo && git format-patch --cover-letter -1 && - ! grep "file => foo .* 0 *$" 0000-cover-letter.patch && + ! grep "file => foo .* 0 *\$" 0000-cover-letter.patch && git format-patch --cover-letter -1 -M && - grep "file => foo .* 0 *$" 0000-cover-letter.patch + grep "file => foo .* 0 *\$" 0000-cover-letter.patch ' @@ -425,7 +425,7 @@ EOF test_expect_success 'shortlog of cover-letter wraps overly-long onelines' ' git format-patch --cover-letter -2 && - sed -e "1,/A U Thor/d" -e "/^$/q" < 0000-cover-letter.patch > output && + sed -e "1,/A U Thor/d" -e "/^\$/q" < 0000-cover-letter.patch > output && test_cmp expect output ' @@ -450,7 +450,7 @@ EOF test_expect_success 'format-patch respects -U' ' git format-patch -U4 -2 && - sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output && + sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output && test_cmp expect output ' @@ -471,7 +471,7 @@ EOF test_expect_success 'format-patch -p suppresses stat' ' git format-patch -p -2 && - sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output && + sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output && test_cmp expect output ' @@ -536,4 +536,29 @@ test_expect_success 'format-patch --signoff' ' grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" ' +echo "fatal: --name-only does not make sense" > expect.name-only +echo "fatal: --name-status does not make sense" > expect.name-status +echo "fatal: --check does not make sense" > expect.check + +test_expect_success 'options no longer allowed for format-patch' ' + test_must_fail git format-patch --name-only 2> output && + test_cmp expect.name-only output && + test_must_fail git format-patch --name-status 2> output && + test_cmp expect.name-status output && + test_must_fail git format-patch --check 2> output && + test_cmp expect.check output' + +test_expect_success 'format-patch --numstat should produce a patch' ' + git format-patch --numstat --stdout master..side > output && + test 6 = $(grep "^diff --git a/" output | wc -l)' + +test_expect_success 'format-patch -- ' ' + git format-patch master..side -- file 2>error && + ! grep "Use .--" error +' + +test_expect_success 'format-patch --ignore-if-in-upstream HEAD' ' + git format-patch --ignore-if-in-upstream HEAD +' + test_done