Skip to content

Commit

Permalink
Add tests for extra headers in format-patch
Browse files Browse the repository at this point in the history
Presently, it works with each header ending with a newline, but not
without the newlines.

Also add a test to see that multiple "To:" headers get combined.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Daniel Barkalow authored and Junio C Hamano committed Feb 20, 2008
1 parent a5a27c7 commit a8d8173
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions t/t4014-format-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,40 @@ test_expect_success 'replay did not screw up the log message' '
'

test_expect_success 'extra headers' '
git config format.headers "To: R. E. Cipient <rcipient@example.com>
" &&
git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>
" &&
git format-patch --stdout master..side > patch2 &&
sed -e "/^$/Q" patch2 > hdrs2 &&
grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs2 &&
grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs2
'

test_expect_failure 'extra headers without newlines' '
git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>" &&
git format-patch --stdout master..side >patch3 &&
sed -e "/^$/Q" patch3 > hdrs3 &&
grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs3 &&
grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs3
'

test_expect_failure 'extra headers with multiple To:s' '
git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
git config --add format.headers "To: S. E. Cipient <scipient@example.com>" &&
git format-patch --stdout master..side > patch4 &&
sed -e "/^$/Q" patch4 > hdrs4 &&
grep "^To: R. E. Cipient <rcipient@example.com>,$" hdrs4 &&
grep "^ *S. E. Cipient <scipient@example.com>$" hdrs4
'

test_expect_success 'multiple files' '
rm -rf patches/ &&
Expand Down

0 comments on commit a8d8173

Please sign in to comment.