aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>2023-08-21 19:07:20 +0200
committerJunio C Hamano <gitster@pobox.com>2023-08-21 15:03:47 -0700
commit67f4b36e339d91c06ff9cdc254864c830158e10f (patch)
tree9669710eb67178297355fdacfa2b016e2309797a /t
parentfac96dfbb1c24369ba7d37a5affd8adfe6c650fd (diff)
downloadgit-67f4b36e339d91c06ff9cdc254864c830158e10f.tar.xz
format-patch: add --description-file option
This patch makes it possible to directly feed a branch description to derive the cover letter from. The use case is formatting dynamically created temporary commits which are not referenced anywhere. The most obvious alternative would be creating a temporary branch and setting a description on it, but that doesn't seem particularly elegant. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4014-format-patch.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 3cf2b7a7fb..bc0e29b31a 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -1991,6 +1991,20 @@ test_expect_success 'cover letter using branch description (6)' '
grep hello actual
'
+test_expect_success 'cover letter with --description-file' '
+ test_when_finished "rm -f description.txt" &&
+ cat >description.txt <<-\EOF &&
+ subject from file
+
+ body from file
+ EOF
+ git checkout rebuild-1 &&
+ git format-patch --stdout --cover-letter --cover-from-description auto \
+ --description-file description.txt main >actual &&
+ grep "^Subject: \[PATCH 0/2\] subject from file$" actual &&
+ grep "^body from file$" actual
+'
+
test_expect_success 'cover letter with nothing' '
git format-patch --stdout --cover-letter >actual &&
test_line_count = 0 actual