X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft4014-format-patch.sh;h=922a8941ed4720e2ad6dcd500a3759187aace969;hb=261fbda903762b9c47e4138312673ea25555d9e5;hp=f187d15e328aa43f3d7a7b9030158e0128cc4812;hpb=3c91bf6805249d0f59ddff4e5dc4118127527243;p=git.git diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index f187d15e3..7f267f9ed 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -128,6 +128,21 @@ test_expect_success 'additional command line cc' ' 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 +' + +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 +' + test_expect_success 'multiple files' ' rm -rf patches/ && @@ -440,6 +455,27 @@ test_expect_success 'format-patch respects -U' ' ' +cat > expect << EOF + +diff --git a/file b/file +index 40f36c6..2dc5c23 100644 +--- a/file ++++ b/file +@@ -14,3 +14,19 @@ C + D + E + F ++5 +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 && + test_cmp expect output + +' + test_expect_success 'format-patch from a subdirectory (1)' ' filename=$( rm -rf sub && @@ -478,16 +514,42 @@ test_expect_success 'format-patch from a subdirectory (2)' ' ' test_expect_success 'format-patch from a subdirectory (3)' ' - here="$TEST_DIRECTORY/$test" && rm -f 0* && filename=$( rm -rf sub && mkdir -p sub/dir && cd sub/dir && - git format-patch -1 -o "$here" + git format-patch -1 -o "$TRASH_DIRECTORY" ) && basename=$(expr "$filename" : ".*/\(.*\)") && test -f "$basename" ' +test_expect_success 'format-patch --in-reply-to' ' + git format-patch -1 --stdout --in-reply-to "baz@foo.bar" > patch8 && + grep "^In-Reply-To: " patch8 && + grep "^References: " patch8 +' + +test_expect_success 'format-patch --signoff' ' + git format-patch -1 --signoff --stdout | + 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_done