summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-02-22 19:26:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-22 22:25:35 (GMT)
commit2fe95f494cde6cb3c3e6894bb687961b28b1764b (patch)
tree3220d3211082b8bde9f21908844a9e6ff218c67b /t/t4014-format-patch.sh
parentbc208ae31417ea4fecad14edcdb8b6c7decb0c38 (diff)
downloadgit-2fe95f494cde6cb3c3e6894bb687961b28b1764b.zip
git-2fe95f494cde6cb3c3e6894bb687961b28b1764b.tar.gz
git-2fe95f494cde6cb3c3e6894bb687961b28b1764b.tar.bz2
format-patch: notice failure to open cover letter for writing
The make_cover_letter() function is supposed to open a new file for writing, and let the caller write into it via FILE *rev->diffopt.file but because the function does not return anything, the caller does not bother checking the return value. Make sure it dies, instead of keep going with a NULL output filestream and relying on it to cause a crash, when it fails to open the file. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 909c743..b6e2fdb 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -589,6 +589,12 @@ test_expect_success 'excessive subject' '
ls patches/0004-This-is-an-excessively-long-subject-line-for-a-messa.patch
'
+test_expect_success 'failure to write cover-letter aborts gracefully' '
+ test_when_finished "rmdir 0000-cover-letter.patch" &&
+ mkdir 0000-cover-letter.patch &&
+ test_must_fail git format-patch --no-renames --cover-letter -1
+'
+
test_expect_success 'cover-letter inherits diff options' '
git mv file foo &&
git commit -m foo &&