summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
AgeCommit message (Collapse)Author
2010-06-16format-patch: Add a signature option (--signature)Stephen Boyd
By default, git uses the version string as the signature for all patches output by format-patch. Many employers (mine included) require the use of a signature on all outgoing mails. In a format-patch | send-email workflow there isn't an easy way to modify the signature without breaking the pipe and manually replacing the version string with the signature required. Instead of doing all that work, add an option (--signature) and a config variable (format.signature) to replace the default git version signature when formatting patches. This does modify the original behavior of format-patch a bit. First off the version string is now placed in the cover letter by default. Secondly, once the configuration variable format.signature is added to the .config file there is no way to revert back to the default git version signature. Instead, specifying the --no-signature option will remove the signature from the patches entirely. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-30Merge branch 'maint'Junio C Hamano
* maint: format-patch: Squelch 'fatal: Not a range." error
2010-03-30format-patch: Squelch 'fatal: Not a range." errorKevin Ballard
Don't output an error on `git format-patch --ignore-if-in-upstream HEAD`. This matches the behavior of `git format-patch HEAD`. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-08format-patch: add --no-cc, --no-to, and --no-add-headersStephen Boyd
These new options allow users to override their config settings for format.cc, format.to and format.headers respectively. These options only make git ignore the config settings and any previous command line options, so you'll still have to add more command line options to add extra headers. For example, $ cat .git/config [format] to = Someone <someone@out.there> $ git format-patch -1 --no-to --to="Someone Else <else@out.there>" would format a patch addressed to "Someone Else" and not "Someone". Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-07Add 'git format-patch --to=' option and 'format.to' configuration variable.Steven Drake
Has the same functionality as the '--cc' option and 'format.cc' configuration variable but for the "To:" email header. Half of the code to support this was already there. With email the To: header usually more important than the Cc: header. [jc: tests are by Stephen Boyd] Signed-off-by: Steven Drake <sdrake@xnet.co.nz> Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-26fix portability issues with $ in double quotesStephen Boyd
Using a dollar sign in double quotes isn't portable. Escape them with a backslash or replace the double quotes with single quotes. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-30Merge branch 'fc/maint-format-patch-pathspec-dashes'Junio C Hamano
Conflicts: t/t4014-format-patch.sh
2009-11-27format-patch: add test for parsing of "--"Felipe Contreras
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-23t4014-format-patch: do not assume 'test' is available as non-builtinJohannes Sixt
One test case used 'xargs test', which assumes that 'test' is available as external program. At least on MinGW it is not. Moreover, 'git format-patch' was invoked in a pipeline, but not as the last command. Rewrite the test case to catch breakage in 'git format-patch' as well. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10format-patch: Always generate a patchBjörn Gustavsson
Jeff King recently reinstated -p to suppress the default diffstat (as -p used to work before 68daa64, about 14 months ago). However, -p is also needed in combination with certain options (e.g. --stat or --numstat) in order to produce any patch at all. The documentation does not mention this. Since the purpose of format-patch is to produce a patch that can be emailed, it does not make sense that certain combination of options will suppress the generation of the patch itself. Therefore: * Update 'git format-patch' to always generate a patch. * Since the --name-only, --name-status, and --check suppresses the generation of the patch, disallow those options, and remove the description of them in the documentation. * Remove the reference to -p in the description of -U. * Remove the descriptions of the options that are synonyms for -p plus another option (--patch-with-raw and --patch-with-stat). * While at it, slightly tweak the description of -p itself to say that it generates "plain patches", so that you can think of -p as "plain patch" as an mnemonic aid. Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-09format-patch: make "-p" suppress diffstatJeff King
Once upon a time, format-patch would use its default stat plus patch format only when no diff format was given on the command line. This meant that "format-patch -p" would suppress the stat and show just the patch. Commit 68daa64 changed this to keep the stat format when we had an "implicit" patch format, like "-U5". As a side effect, this meant that an explicit patch format was now ignored (because cmd_format_patch didn't know the reason that the format was set way down in diff_opt_parse). This patch unbreaks what 68daa64 did (while still preserving what 68daa64 was trying to do), reinstating "-p" to suppress the default behavior. We do this by parsing "-p" ourselves in format-patch, and noting whether it was used explicitly. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-09tests: provide $TRASH_DIRECTORY variableJeff King
Most scripts don't care about the absolute path to the trash directory. The one exception was t4014 script, which pieced together $TEST_DIRECTORY and $test itself to get an absolute directory. Instead, let's provide a $TRASH_DIRECTORY which specifies the same thing. This keeps the $test variable internal to test-lib.sh and paves the way for trash directories in other locations. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16tests: Add tests for missing format-patch long optionsStephen Boyd
Exercise format-patch's --signoff, --in-reply-to and --start-number long options. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-28format-patch: add arbitrary email headersMichael Hendricks
format-patch supports the format.headers configuration for adding arbitrary email headers to the patches it outputs. This patch adds support for an --add-header argument which makes the same feature available from the command line. This is useful when the content of custom email headers must change from branch to branch. This patch has been sponsored by Grant Street Group Signed-off-by: Michael Hendricks <michael@ndrix.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-19test-lib: Introduce test_chmod and use it instead of update-index --chmodJohannes Sixt
This function replaces sequences of 'chmod +x' and 'git update-index --chmod=+x' in the test suite, whose purpose is to help filesystems that need core.filemode=false. Two places where only 'chmod +x' was used we also use this new function. The function calls 'git update-index --chmod' without checking core.filemode (unlike some of the call sites did). We do this because the call sites *expect* that the executable bit ends up in the index (ie. it is not the purpose of the call sites to *test* whether git treats 'chmod +x' and 'update-index --chmod=+x' correctly). Therefore, on filesystems with core.filemode=true the 'git update-index --chmod' is a no-op. The function uses --add with update-index to help one call site in t6031-merge-recursive. It makes no difference for the other callers. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-02-22format-patch: support deep threadingThomas Rast
For deep threading mode, i.e., the mode that gives a thread structured like + [PATCH 0/n] Cover letter `-+ [PATCH 1/n] First patch `-+ [PATCH 2/n] Second patch `-+ ... we currently have to use 'git send-email --thread' (the default). On the other hand, format-patch also has a --thread option which gives shallow mode, i.e., + [PATCH 0/n] Cover letter |-+ [PATCH 1/n] First patch |-+ [PATCH 2/n] Second patch ... To reduce the confusion resulting from having two indentically named features in different tools giving different results, let format-patch take an optional argument '--thread=deep' that gives the same output as 'send-mail --thread'. With no argument, or 'shallow', behave as before. Also add a configuration variable format.thread with the same semantics. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-22format-patch: thread as reply to cover letter even with in-reply-toThomas Rast
Currently, format-patch --thread --cover-letter --in-reply-to $parent makes all mails, including the cover letter, a reply to $parent. However, we would want the reader to consider the cover letter above all the patches. This changes the semantics so that only the cover letter is a reply to $parent, while all the patches are formatted as replies to the cover letter. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-20format-patch: threading test reactivationThomas Rast
t4014 tests format-patch --thread since 7d812145, but the tests were ineffective right from the start at least for bash and dash. The loops of the form for ...; do something || break; done introduced by 7d812145 and 5d02294 always exit with status 0, even if 'something' failed, because 'break' returns 0 unless there was no loop to break. We take a rather different approach that uses an admittedly heinous inline Perl script to mangle all interesting information into a format that is invariant between runs. We can then test the full patch sequence in one go (with --stdout), doing away with the loop problem. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-22Merge branch 'jc/maint-format-patch-o-relative'Junio C Hamano
* jc/maint-format-patch-o-relative: Teach format-patch to handle output directory relative to cwd Conflicts: t/t4014-format-patch.sh
2009-01-13Teach format-patch to handle output directory relative to cwdJunio C Hamano
Without any explicit -o parameter, we correctly avoided putting the resulting patch output to the toplevel. We should do the same when the user gave a relative pathname to be consistent with this case. Noticed by Cesar Eduardo Barros. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-27format-patch: use default diff format even with patch optionsJeff King
Previously, running "git format-patch -U5" would cause the low-level diff machinery to change the diff output format from "not specified" to "patch". This meant that format-patch thought we explicitly specified a diff output format, and would not use the default format. The resulting message lacked both the diffstat and the summary, as well as the separating "---". Now format-patch explicitly checks for this condition and uses the default. That means that "git format-patch -p" will now have the "-p" ignored. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-14fix whitespace violations in test scriptsJeff King
These violations are simply wrong, but were never caught because whitespace policy checking is turned off in the test scripts. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-24tests: do not use implicit "git diff --no-index"Junio C Hamano
As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-02format-patch: wrap cover-letter's shortlog sensiblyJohannes Schindelin
Earlier, overly-long onelines would not be wrapped at all, and indented with 6 spaces. Instead, we now wrap around at 72 characters, with a first-line indent of 2 spaces, and the rest with 4 spaces. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-02format-patch: use the diff options for the cover letter, tooJohannes Schindelin
Earlier, when you called "git format-patch --cover-letter -M", the diffstat in the cover letter would not inherit the "-M". Now it does. While at it, add a few "|| break" statements in the test's loops; otherwise, breakages inside the loops would not be caught. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-24t4014: Replace sed's non-standard 'Q' by standard 'q'Steffen Prohaska
t4014 test used GNU extension 'Q' in its sed scripts, but the uses can safely be replaced with 'q'. Among other platforms, sed on Mac OS X 10.4 does not accept the former. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-20Support a --cc=<email> option in format-patchDaniel Barkalow
When you have particular reviewers you want to sent particular series to, it's nice to be able to generate the whole series with them as additional recipients, without configuring them into your general headers or adding them by hand afterwards. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-20Combine To: and Cc: headersDaniel Barkalow
RFC 2822 only permits a single To: header and a single Cc: header, so we need to turn multiple values of each of these into a list. This will be particularly significant with a command-line option to add Cc: headers, where the user can't make sure to configure valid header sets in any easy way. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-20Fix format.headers not ending with a newlineDaniel Barkalow
Now each value of format.headers will always be treated as a single valid header, and newlines will be inserted between them as needed. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-20Add tests for extra headers in format-patchDaniel Barkalow
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>
2008-02-20Add a --cover-letter option to format-patchDaniel Barkalow
If --cover-letter is provided, generate a cover letter message before the patches, numbered 0. Original patch thanks to Johannes Schindelin Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-19Add more tests for format-patchDaniel Barkalow
Tests -o, and an excessively long subject, and --thread, with and without --in-reply-to= Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-18t/t4014: test "am -3" with mode-only change.Junio C Hamano
Earlier commit ece7b74903007cee8d280573647243d46a6f3a95 added a test for rebase that uses "am -3", but this adds a test to check "am -3" itself. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-05-26Add tests for the last two fixes.Junio C Hamano
This updates t4014 to check the two fixes for git-am and git-commit we observed with "echo" that does backslash interpolation by default without being asked with -e option. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-29t4014: fix test commit labels.Junio C Hamano
The commit tag and commit comments used in the test claimed that the #1 commit was merged upstream where the test actually let the upstream merge #2 commit. Fix them. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-27t4014: fix for whitespace from "wc -l"Johannes Schindelin
Some "wc" insist on putting a TAB in front of the number. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-26t4014: add format-patch --ignore-if-in-upstream testJunio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>