Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2023-03-03 19:03:01 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-03 20:13:52 +0300
commit94c4289435605a9c39951ccebaf82f131e07c255 (patch)
tree2e8d86f11250688b184886839c924f93a8336722 /t/t4014-format-patch.sh
parentd15644fe0226af7ffc874572d968598564a230dd (diff)
format-patch: output header for empty commits
When formatting an empty commit, it is surprising that a totally empty file is generated. Set the flag to always print the header, matching the behaviour of git-log. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index f3313b8c58..ffc7c60680 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -59,6 +59,10 @@ test_expect_success setup '
test_tick &&
git commit -m "patchid 3" &&
+ git checkout -b empty main &&
+ test_tick &&
+ git commit --allow-empty -m "empty commit" &&
+
git checkout main
'
@@ -128,6 +132,12 @@ test_expect_success 'replay did not screw up the log message' '
grep "^Side .* with .* backslash-n" actual
'
+test_expect_success 'format-patch empty commit' '
+ git format-patch --stdout main..empty >empty &&
+ grep "^From " empty >from &&
+ test_line_count = 1 from
+'
+
test_expect_success 'extra headers' '
git config format.headers "To: R E Cipient <rcipient@example.com>
" &&