1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-08 21:26:08 +02:00

Merge branch 'jk/format-patch-change-format-for-empty-commits'

"git format-patch" learned to write a log-message only output file
for empty commits.

* jk/format-patch-change-format-for-empty-commits:
  format-patch: output header for empty commits
This commit is contained in:
Junio C Hamano 2023-03-19 15:03:12 -07:00
commit 5c92a451be
2 changed files with 11 additions and 0 deletions

View File

@ -2097,6 +2097,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
/* Always generate a patch */
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
rev.always_show_header = 1;
rev.zero_commit = zero_commit;
rev.patch_name_max = fmt_patch_name_max;

View File

@ -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>
" &&