summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
Commit message (Collapse)AuthorAgeFilesLines
* format-patch: add "--signature-file=<file>" optionjm/format-patch-mail-sigJeremiah Mahler2014-05-271-0/+61
| | | | | | | | | | | | | | | | Add an option to format-patch for reading a signature from a file. $ git format-patch -1 --signature-file=$HOME/.signature The config variable `format.signaturefile` can also be used to make this the default. $ git config format.signaturefile $HOME/.signature $ git format-patch -1 Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* tests: use "env" to run commands with temporary env-var settingsdt/tests-with-env-not-subshellDavid Tran2014-03-191-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Ordinarily, we would say "VAR=VAL command" to execute a tested command with environment variable(s) set only for that command. This however does not work if 'command' is a shell function (most notably 'test_must_fail'); the result of the assignment is retained and affects later commands. To avoid this, we used to assign and export environment variables and run such a test in a subshell, like so: ( VAR=VAL && export VAR && test_must_fail git command to be tested ) But with "env" utility, we should be able to say: test_must_fail env VAR=VAL git command to be tested which is much shorter and easier to read. Signed-off-by: David Tran <unsignedzero@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t: use perl instead of "$PERL_PATH" where applicablejk/wrap-perl-used-in-testsJeff King2013-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | As of the last commit, we can use "perl" instead of "$PERL_PATH" when running tests, as the former is now a function which uses the latter. As the shorter "perl" is easier on the eyes, let's switch to using it everywhere. This is not quite a mechanical s/$PERL_PATH/perl/ replacement, though. There are some places where we invoke perl from a script we generate on the fly, and those scripts do not have access to our internal shell functions. The result can be double-checked by running: ln -s /bin/false bin-wrappers/perl make test which continues to pass even after this patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* format-patch: print in-body "From" only when neededjk/format-patch-fromJeff King2013-09-201-0/+10
| | | | | | | | | | | | | | | | | | | | Commit a908047 taught format-patch the "--from" option, which places the author ident into an in-body from header, and uses the committer ident in the rfc822 from header. The documentation claims that it will omit the in-body header when it is the same as the rfc822 header, but the code never implemented that behavior. This patch completes the feature by comparing the two idents and doing nothing when they are the same (this is the same as simply omitting the in-body header, as the two are by definition indistinguishable in this case). This makes it reasonable to turn on "--from" all the time (if it matches your particular workflow), rather than only using it when exporting other people's patches. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* teach format-patch to place other authors into in-body "From"Jeff King2013-07-031-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | Format-patch generates emails with the "From" address set to the author of each patch. If you are going to send the emails, however, you would want to replace the author identity with yours (if they are not the same), and bump the author identity to an in-body header. Normally this is handled by git-send-email, which does the transformation before sending out the emails. However, some workflows may not use send-email (e.g., imap-send, or a custom script which feeds the mbox to a non-git MUA). They could each implement this feature themselves, but getting it right is non-trivial (one must canonicalize the identities by reversing any RFC2047 encoding or RFC822 quoting of the headers, which has caused many bugs in send-email over the years). This patch takes a different approach: it teaches format-patch a "--from" option which handles the ident check and in-body header while it is writing out the email. It's much simpler to do at this level (because we haven't done any quoting yet), and any workflow based on format-patch can easily turn it on. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'fc/send-email-annotate'Junio C Hamano2013-04-181-0/+33
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows format-patch --cover-letter to be configurable; the most notable is the "auto" mode to create cover-letter only for multi patch series. * fc/send-email-annotate: rebase-am: explicitly disable cover-letter format-patch: trivial cleanups format-patch: add format.coverLetter configuration variable log: update to OPT_BOOL format-patch: refactor branch name calculation format-patch: improve head calculation for cover-letter send-email: make annotate configurable
| * format-patch: add format.coverLetter configuration variableFelipe Contreras2013-04-071-0/+28
| | | | | | | | | | | | | | | | Also, add a new option: 'auto', so if there's more than one patch, the cover letter is generated, otherwise it's not. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * format-patch: improve head calculation for cover-letterFelipe Contreras2013-04-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we do it after the revision traversal we can be sure that this is indeed a commit that will be processed (i.e. not a merge) and it's the top most one (thus removing the NEEDSWORK comment, at least we show the same as 'git diff --stat' output that appears in the cover-letter). While we are at it, since we know there's nothing to generate, exit sooner in all cases, like --cover-letter currently does. Also, if there's nothing to generate and cover-letter is specified, a different code-path might be triggered that is not currently covered in the test-case, so add a test for it. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Sync with 'maint'Junio C Hamano2013-04-121-3/+3
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | * maint: Correct common spelling mistakes in comments and tests kwset: fix spelling in comments precompose-utf8: fix spelling of "want" in error message compat/nedmalloc: fix spelling in comments compat/regex: fix spelling and grammar in comments obstack: fix spelling of similar contrib/subtree: fix spelling of accidentally git-remote-mediawiki: spelling fixes doc: various spelling fixes fast-export: fix argument name in error messages Documentation: distinguish between ref and offset deltas in pack-format i18n: make the translation of -u advice in one go
| * Correct common spelling mistakes in comments and testsStefano Lattarini2013-04-121-3/+3
| | | | | | | | | | | | | | | | | | Most of these were found using Lucas De Marchi's codespell tool. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Merge branch 'ks/rfc2047-one-char-at-a-time' into maintJunio C Hamano2013-04-031-13/+14
| |\ | | | | | | | | | | | | | | | | | | | | | | | | When "format-patch" quoted a non-ascii strings on the header files, it incorrectly applied rfc2047 and chopped a single character in the middle of it. * ks/rfc2047-one-char-at-a-time: format-patch: RFC 2047 says multi-octet character may not be split
* | \ Merge branch 'bc/append-signed-off-by'Junio C Hamano2013-04-011-0/+262
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consolidate codepaths that inspect log-message-to-be and decide to add a new Signed-off-by line in various commands. * bc/append-signed-off-by: git-commit: populate the edit buffer with 2 blank lines before s-o-b Unify appending signoff in format-patch, commit and sequencer format-patch: update append_signoff prototype t4014: more tests about appending s-o-b lines sequencer.c: teach append_signoff to avoid adding a duplicate newline sequencer.c: teach append_signoff how to detect duplicate s-o-b sequencer.c: always separate "(cherry picked from" from commit body sequencer.c: require a conforming footer to be preceded by a blank line sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footer t/t3511: add some tests of 'cherry-pick -s' functionality t/test-lib-functions.sh: allow to specify the tag name to test_commit commit, cherry-pick -s: remove broken support for multiline rfc2822 fields sequencer.c: rework search for start of footer to improve clarity
| * | | Unify appending signoff in format-patch, commit and sequencerBrandon Casey2013-02-121-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two implementations of append_signoff in log-tree.c and sequencer.c, which do more or less the same thing. Unify on top of the sequencer.c implementation. Add a test in t4014 to demonstrate support for non-s-o-b elements in the commit footer provided by sequence.c:append_sob. Mark tests fixed as appropriate. [Commit message mostly stolen from Nguyễn Thái Ngọc Duy's original unification patch] Signed-off-by: Brandon Casey <bcasey@nvidia.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | t4014: more tests about appending s-o-b linesNguyễn Thái Ngọc Duy2013-02-121-0/+241
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [bc: Squash the tests from Duy's original unify-appending-sob series. Fix test 90 "signoff: some random signoff-alike" and mark as failing. Correct behavior should insert a blank line after message body and signed-off-by. Add two additional tests: 1. failure to detect non-conforming elements in the footer when last line matches committer's s-o-b. 2. ensure various s-o-b -like elements in the footer are handled as conforming. e.g. "Change-id: IXXXX or Bug: 1234" ] Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Brandon Casey <bcasey@nvidia.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'ks/rfc2047-one-char-at-a-time'Junio C Hamano2013-03-251-13/+14
|\ \ \ \ | |_|/ / |/| | / | | |/ | |/| | | | | | | | | | | | | When "format-patch" quoted a non-ascii strings on the header files, it incorrectly applied rfc2047 and chopped a single character in the middle of it. * ks/rfc2047-one-char-at-a-time: format-patch: RFC 2047 says multi-octet character may not be split
| * | format-patch: RFC 2047 says multi-octet character may not be splitKirill Smelkov2013-03-091-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though an earlier attempt (bafc478..41dd00bad) cleaned up RFC 2047 encoding, pretty.c::add_rfc2047() still decides where to split the output line by going through the input one byte at a time, and potentially splits a character in the middle. A subject line may end up showing like this: ".... fö?? bar". (instead of ".... föö bar".) if split incorrectly. RFC 2047, section 5 (3) explicitly forbids such beaviour Each 'encoded-word' MUST represent an integral number of characters. A multi-octet character may not be split across adjacent 'encoded- word's. that means that e.g. for Subject: .... föö bar encoding Subject: =?UTF-8?q?....=20f=C3=B6=C3=B6?= =?UTF-8?q?=20bar?= is correct, and Subject: =?UTF-8?q?....=20f=C3=B6=C3?= <-- NOTE ö is broken here =?UTF-8?q?=B6=20bar?= is not, because "ö" character UTF-8 encoding C3 B6 is split here across adjacent encoded words. To fix the problem, make the loop grab one _character_ at a time and determine its output length to see where to break the output line. Note that this version only knows about UTF-8, but the logic to grab one character is abstracted out in mbs_chrlen() function to make it possible to extend it to other encodings with the help of iconv in the future. Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/format-patch-reroll'Junio C Hamano2013-01-111-0/+16
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach "format-patch" to prefix v4- to its output files for the fourth iteration of a patch series, to make it easier for the submitter to keep separate copies for iterations. * jc/format-patch-reroll: format-patch: give --reroll-count a short synonym -v format-patch: document and test --reroll-count format-patch: add --reroll-count=$N option get_patch_filename(): split into two functions get_patch_filename(): drop "just-numbers" hack get_patch_filename(): simplify function signature builtin/log.c: stop using global patch_suffix builtin/log.c: drop redundant "numbered_files" parameter from make_cover_letter() builtin/log.c: drop unused "numbered" parameter from make_cover_letter()
| * | | format-patch: give --reroll-count a short synonym -vJunio C Hamano2013-01-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accept "-v" as a synonym to "--reroll-count", so that users can say "git format-patch -v4 master", instead of having to fully spell it out as "git format-patch --reroll-count=4 master". As I do not think of a reason why users would want to tell the command to be "verbose", I think this should be OK. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | format-patch: document and test --reroll-countJunio C Hamano2013-01-021-0/+8
| | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'nd/maint-branch-desc-doc'Junio C Hamano2013-01-091-0/+42
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach various forms of "format-patch" command line to identify what branch the patches are taken from, so that the branch description is picked up in more cases. * nd/maint-branch-desc-doc: format-patch: pick up branch description when no ref is specified format-patch: pick up correct branch name from symbolic ref t4014: a few more tests on cover letter using branch description branch: delete branch description if it's empty config.txt: a few lines about branch.<name>.description
| * | | | format-patch: pick up branch description when no ref is specifiedNguyễn Thái Ngọc Duy2013-01-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only try to get branch name in "format-patch origin" case or similar and not "format-patch -22" where HEAD is automatically added. Without correct branch name, branch description cannot be added. Make sure we always get branch name. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | format-patch: pick up correct branch name from symbolic refNguyễn Thái Ngọc Duy2013-01-031-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | find_branch_name() assumes to take refs/heads/<branch>. But we also have symbolic refs, such as HEAD, that can point to a valid branch in refs/heads and do not follow refs/heads/<branch> syntax. Remove the assumption and apply normal ref resolution. After all it would be confusing if rev machinery resolves a ref in one way and find_branch_name() another. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | t4014: a few more tests on cover letter using branch descriptionNguyễn Thái Ngọc Duy2013-01-031-0/+21
| |/ / / | | | | | | | | | | | | | | | | Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'jc/maint-test-portability'Junio C Hamano2013-01-021-3/+3
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | t4014, t9502 and t0200 tests had various portability issues that broke on OpenBSD. * jc/maint-test-portability: t4014: fix arguments to grep t9502: do not assume GNU tar t0200: "locale" may not exist
| * | | t4014: fix arguments to grepJunio C Hamano2012-12-191-3/+3
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These "expect-failure" tests were not looking for the right string in the patch file. For example: grep "^ *"S. E. Cipient" <scipient@example.com>\$" patch5 was looking for "^ *S." in these three files: "E." "Cipient <scipient@example.com>$" "patch5" With some implementations of grep, the lack of file "E." was reported as an error, leading to the failure of the test. With other implementations of grep, the pattern "^ *S." matched what was in patch5, without diagnosing the missing files as an error, and made these tests unexpectedly pass. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/prettier-pretty-note'Junio C Hamano2012-11-151-2/+13
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Emit the notes attached to the commit in "format-patch --notes" output after three-dashes. * jc/prettier-pretty-note: format-patch: add a blank line between notes and diffstat Doc User-Manual: Patch cover letter, three dashes, and --notes Doc format-patch: clarify --notes use case Doc notes: Include the format-patch --notes option Doc SubmittingPatches: Mention --notes option after "cover letter" Documentation: decribe format-patch --notes format-patch --notes: show notes after three-dashes format-patch: append --signature after notes pretty_print_commit(): do not append notes message pretty: prepare notes message at a centralized place format_note(): simplify API pretty: remove reencode_commit_message()
| * | format-patch --notes: show notes after three-dashesJunio C Hamano2012-10-171-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | When inserting the note after the commit log message to format-patch output, add three dashes before the note. Record the fact that we did so in the rev_info and omit showing duplicated three dashes in the usual codepath that is used when notes are not being shown. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | format-patch: append --signature after notesJunio C Hamano2012-10-171-2/+10
| |/ | | | | | | | | | | | | | | | | | | When appending a new signature with "format-patch --signature", if the "--notes" option is also in effect, the location of the new signature (and if the signature should be added in the first place) should be decided using the contents of the original commit log message, before the message from the notes is added. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | format-patch tests: check quoting/encoding in To: and Cc: headersJan H. Schönherr2012-10-181-32/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git-format-patch does currently not parse user supplied extra header values (e. g., --cc, --add-header) and just replays them. That forces users to add them RFC 2822/2047 conform in encoded form, e.g. --cc '=?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= <...>' which is inconvenient. We would want to update git-format-patch to accept human-readable input --cc 'Jan H. Schönherr <...>' and handle the encoding, wrapping and quoting internally in the future, similar to what is already done in git-send-email. The necessary code should mostly exist in the code paths that handle the From: and Subject: headers. Whether we want to do this only for the git-format-patch options --to and --cc (and the corresponding config options) or also for user supplied headers via --add-header, is open for discussion. For now, add test_expect_failure tests for To: and Cc: headers as a reminder and fix tests that would otherwise fail should this get implemented. Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | format-patch: fix rfc2047 address encoding with respect to rfc822 specialsJan H. Schönherr2012-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to RFC 2047 and RFC 822, rfc2047 encoded words and and rfc822 quoted strings do not mix. Since add_rfc2047() no longer leaves RFC 822 specials behind, the quoting is also no longer necessary to create a standard-conforming mail. Remove the quoting, when RFC 2047 encoding takes place. This actually requires to refactor add_rfc2047() a bit, so that the different cases can be distinguished. With this patch, my own name gets correctly decoded as Jan H. Schönherr (without quotes) and not as "Jan H. Schönherr" (with quotes). Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | format-patch: make rfc2047 encoding more strictJan H. Schönherr2012-10-181-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC 2047 requires more characters to be encoded than it is currently done. Especially, RFC 2047 distinguishes between allowed remaining characters in encoded words in addresses (From, To, etc.) and other headers, such as Subject. Make add_rfc2047() and is_rfc2047_special() location dependent and include all non-allowed characters to hopefully be RFC 2047 conformant. This especially fixes a problem, where RFC 822 specials (e. g. ".") were left unencoded in addresses, which was solved with a non-standard-conforming workaround in the past (which is going to be removed in a follow-up patch). Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | format-patch: do not wrap rfc2047 encoded headers too lateJan H. Schönherr2012-10-181-23/+35
| | | | | | | | | | | | | | | | | | | | | | | | Encoded characters add more than one character at once to an encoded header. Include all characters that are about to be added in the length calculation for wrapping. Additionally, RFC 2047 imposes a maximum line length of 76 characters if that line contains an rfc2047 encoded word. Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | format-patch: do not wrap non-rfc2047 headers too earlyJan H. Schönherr2012-10-181-26/+34
|/ | | | | | | | | | | | Do not wrap the second and later lines of non-rfc2047-encoded headers substantially before the 78 character limit. Instead of passing the remaining length of the first line as wrapping width, use the correct maximum length and tell strbuf_add_wrapped_bytes() how many characters of the first line are already used. Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* tests: enclose $PERL_PATH in double quotesJunio C Hamano2012-06-241-1/+1
| | | | | | | Otherwise it will be split at a space after "Program" when it is set to "\\Program Files\perl" or something silly like that. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t: Replace 'perl' by $PERL_PATHVincent van Ravesteijn2012-06-121-1/+1
| | | | | | | | | | | | | | | | | GIT-BUILD-OPTIONS defines PERL_PATH to be used in the test suite. Only a few tests already actually use this variable when perl is needed. The other test just call 'perl' and it might happen that the wrong perl interpreter is used. This becomes problematic on Windows, when the perl interpreter that is compiled and installed on the Windows system is used, because this perl interpreter might introduce some unexpected LF->CRLF conversions. This patch makes sure that $PERL_PATH is used everywhere in the test suite and that the correct perl interpreter is used. Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diffstat summary line varies by locale: miscellanyjn/diffstat-testsJonathan Nieder2012-03-131-6/+3
| | | | | | | | | These changes are in the same spirit as the six patches that precede them, but they haven't been split into individually justifiable patches yet. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Use correct grammar in diffstat summary linend/diffstat-gramnumNguyễn Thái Ngọc Duy2012-02-031-1/+1
| | | | | | | | | | | | | | | | | "git diff --stat" and "git apply --stat" now learn to print the line "%d files changed, %d insertions(+), %d deletions(-)" in singular form whenever applicable. "0 insertions" and "0 deletions" are also omitted unless they are both zero. This matches how versions of "diffstat" that are not prehistoric produced their output, and also makes this line translatable. [jc: with help from Thomas Dickey in archaeology of "diffstat"] [jc: squashed Jonathan's updates to illustrations in tutorials and a test] Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'ph/format-patch-no-color'Junio C Hamano2011-09-191-4/+4
|\ | | | | | | | | * ph/format-patch-no-color: t4014: clean up format.thread config after each test
| * t4014: clean up format.thread config after each testJeff King2011-09-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The threading tests turn on format.thread, but never clean up after themselves, meaning that later tests will also have format.thread set. This is more annoying than most leftover config, too, because not only does it impact the results of other tests, but it does so non-deterministically. Threading requires the generation of message-ids, which incorporate the current time, meaning a slow-running test script may generate different results from run to run. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ph/format-patch-no-color'Junio C Hamano2011-09-141-0/+8
|\ \ | |/ | | | | | | * ph/format-patch-no-color: format-patch: ignore ui.color
| * format-patch: ignore ui.colorPang Yan Han2011-09-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit c9bfb953 (want_color: automatically fallback to color.ui, 2011-08-17) introduced a regression where format-patch produces colorized patches when color.ui is set to "always". In f3aafa4 (Disable color detection during format-patch, 2006-07-09), git_format_config was taught to intercept diff.color to avoid passing it down to git_log_config and later, git_diff_ui_config. Teach git_format_config to intercept color.ui in the same way. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t4014: "no-add-headers" is actually called "no-add-header"Thomas Rast2011-08-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since c426003 (format-patch: add --no-cc, --no-to, and --no-add-headers, 2010-03-07) the tests have checked for an option called --no-add-headers introduced by letting the user negate --add-header. However, the parseopt machinery does not automatically pluralize anything, so it is in fact called --no-add-header. Since the option never worked, is not documented anywhere, and implementing an actual --no-add-headers would lead to silly code complications, we just adapt the test to the code. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t4014: invoke format-patch with --stdout where intendedThomas Rast2011-08-291-2/+2
| | | | | | | | | | | | | | | | | | The test wrote something along the lines of 0001-foo.patch to output, which of course never contained a signature. Luckily the tested behaviour is actually present. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t4014: check for empty files from git format-patch --stdoutThomas Rast2011-08-291-2/+19
|/ | | | | | | | | | | | | | | | | | Most kinds of failure in 'git format-patch --stdout >output' will result in an empty 'output'. This slips past checks that only verify absence of output, such as the '! grep ...' that are quite prevalent in t4014. Introduce a helper check_patch() that checks that at least From, Date and Subject are present, thus making sure it looks vaguely like a patch (or cover letter) email. Then insert calls to it in all tests that do have positive checks for content. This makes two of the tests fail. Mark them as such; they'll be fixed in a moment. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* format-patch: make zero-length subject prefixes prettierJeff King2011-05-301-0/+18
| | | | | | | | | | | | | | | | | | If you give a zero-length subject prefix to format-patch (e.g., "format-patch --subject-prefix="), we will print the ugly: Subject: [ 1/2] your subject here because we always insert a space between the prefix and numbering. Requiring the user to provide the space in their prefix would be more flexible, but would break existing usage. This patch provides a DWIM and suppresses the space for zero-length prefixes, under the assumption that nobody actually wants "[ 1/2]". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jk/format-patch-quote-special-in-from'Junio C Hamano2011-05-061-0/+43
|\ | | | | | | | | | | | | | | | | * jk/format-patch-quote-special-in-from: pretty: quote rfc822 specials in email addresses Conflicts: pretty.c t/t4014-format-patch.sh
| * pretty: quote rfc822 specials in email addressesJeff King2011-04-261-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If somebody has a name that includes an rfc822 special, we will output it literally in the "From:" header. This is usually OK, but certain characters (like ".") are supposed to be enclosed in double-quotes in a mail header. In practice, whether this matters may depend on your MUA. Some MUAs will happily take in: From: Foo B. Bar <author@example.com> without quotes, and properly quote the "." when they send the actual mail. Others may not, or may screw up harder things like: From: Foo "The Baz" Bar <author@example.com> For example, mutt will strip the quotes, thinking they are actual syntactic rfc822 quotes. So let's quote properly, and then (if necessary) we still apply rfc2047 encoding on top of that, which should make all MUAs happy. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jk/format-patch-multiline-header'Junio C Hamano2011-05-041-0/+15
|\ \ | | | | | | | | | | | | * jk/format-patch-multiline-header: format-patch: wrap email addresses after long names
| * | format-patch: wrap email addresses after long namesJeff King2011-04-141-0/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already wrap names in "from" headers, which tend to be the long part of an address. But it's also possible for a long name to not be wrapped, but to make us want to wrap the email address. For example (imagine for the sake of readability we want to wrap at 50 characters instead of 78): From: this is my really long git name <foo@example.com> The name does not overflow the line, but the name and email together do. So we would rather see: From: this is my really long git name <git@example.com> Because we wrap the name separately during add_rfc2047, we neglected this case. Instead, we should see how long the final line of the wrapped name ended up, and decide whether or not to wrap based on that. We can't break the address into multiple parts, so we either leave it with the name, or put it by itself on a line. Test by Erik Faye-Lund. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014Junio C Hamano2011-04-131-4/+4
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>