Skip to content

Commit

Permalink
Merge branch 'mh/format-patch-add-header'
Browse files Browse the repository at this point in the history
* mh/format-patch-add-header:
  format-patch: add arbitrary email headers
  • Loading branch information
gitster committed Apr 2, 2009
2 parents 85b7bd5 + d7d9c2d commit 37a13ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Documentation/git-format-patch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ if that is not set.
Add a "Cc:" header to the email headers. This is in addition
to any configured headers, and may be used multiple times.

--add-header=<header>::
Add an arbitrary header to the email headers. This is in addition
to any configured headers, and may be used multiple times.
For example, --add-header="Organization: git-foo"

--cover-letter::
In addition to the patches, generate a cover letter file
containing the shortlog and the overall diffstat. You can
Expand Down
2 changes: 2 additions & 0 deletions builtin-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
cover_letter = 1;
else if (!strcmp(argv[i], "--no-binary"))
no_binary_diff = 1;
else if (!prefixcmp(argv[i], "--add-header="))
add_header(argv[i] + 13);
else
argv[j++] = argv[i];
}
Expand Down
15 changes: 15 additions & 0 deletions t/t4014-format-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ test_expect_success 'additional command line cc' '
grep "^ *S. E. Cipient <[email protected]>$" patch5
'

test_expect_success 'command line headers' '
git config --unset-all format.headers &&
git format-patch --add-header="Cc: R. E. Cipient <[email protected]>" --stdout master..side | sed -e "/^$/q" >patch6 &&
grep "^Cc: R. E. Cipient <[email protected]>$" patch6
'

test_expect_success 'configuration headers and command line headers' '
git config --replace-all format.headers "Cc: R. E. Cipient <[email protected]>" &&
git format-patch --add-header="Cc: S. E. Cipient <[email protected]>" --stdout master..side | sed -e "/^$/q" >patch7 &&
grep "^Cc: R. E. Cipient <[email protected]>,$" patch7 &&
grep "^ *S. E. Cipient <[email protected]>$" patch7
'

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

0 comments on commit 37a13ac

Please sign in to comment.