aboutsummaryrefslogtreecommitdiff
path: root/git-am.sh
Commit message (Collapse)AuthorAge
* Merge branch 'jc/maint-am-keep'Junio C Hamano2009-11-30
|\
| * Remove dead code from "git am"Junio C Hamano2009-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ever since the initial implementation, "git am" had kept a dead code that never triggered due to a typo in the variable name. Worse yet, the code, if it weren't for the typo, would have attempted to add "[PATCH] " at the beginning of the Subject: header when "git am" is run with its "-k" option. However, because "git am -k" tells mailinfo to keep such prefix when parsing the input, the "[PATCH] " added by this dead code would have really been unnecessary duplicate. Embarrassing is that we kept _maintaining_ the codepath without anybody noticing for four years. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'rs/work-around-grep-opt-insanity'Junio C Hamano2009-11-25
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * rs/work-around-grep-opt-insanity: Protect scripted Porcelains from GREP_OPTIONS insanity mergetool--lib: simplify guess_merge_tool() Conflicts: git-instaweb.sh
| * | Protect scripted Porcelains from GREP_OPTIONS insanityJunio C Hamano2009-11-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user has exported the GREP_OPTIONS environment variable, the output from "grep" and "egrep" in scripted Porcelains may be different from what they expect. For example, we may want to count number of matching lines, by "grep" piped to "wc -l", and GREP_OPTIONS=-C3 will break such use. The approach taken by this change to address this issue is to protect only our own use of grep/egrep. Because we do not unset it at the beginning of our scripts, hook scripts run from the scripted Porcelains are exposed to the same insanity this environment variable causes when grep/egrep is used to implement logic (e.g. "grep | wc -l"), and it is entirely up to the hook scripts to protect themselves. On the other hand, applypatch-msg hook may want to show offending words in the proposed commit log message using grep to the end user, and the user might want to set GREP_OPTIONS=--color to paint the match more visibly. The approach to protect only our own use without unsetting the environment variable globally will allow this use case. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'ls/maint-mailinfo-no-inbody'Junio C Hamano2009-11-22
|\ \ \ | | | | | | | | | | | | | | | | * ls/maint-mailinfo-no-inbody: git am/mailinfo: Don't look at in-body headers when rebasing
| * | | git am/mailinfo: Don't look at in-body headers when rebasingLukas Sandström2009-11-20
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we are rebasing we know that the header lines in the patch are good and that we don't need to pick up any headers from the body of the patch. This makes it possible to rebase commits whose commit message start with "From" or "Date". Test vectors by Jeff King. Signed-off-by: Lukas Sandström <luksan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | am -i, git-svn: use "git var GIT_PAGER"Jonathan Nieder2009-11-13
|/ / | | | | | | | | | | | | | | | | | | Use the new "git var GIT_PAGER" command to ask what pager to use. Without this change, the core.pager configuration is ignored by these commands. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: force egrep to use correct characters setChristian Himpel2009-09-25
| | | | | | | | | | | | | | | | According to egrep(1) the US-ASCII table is used when LC_ALL=C is set. We do not rely here on the LC_ALL value we get from the environment. Signed-off-by: Christian Himpel <chressie@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | git-am: fixed patch_format detection according to RFC2822Christian Himpel2009-09-25
| | | | | | | | | | | | | | | | | | | | | | | | RFC2822 specifies in paragraph 3.6.8, that optional header fields are made up of any printable US-ASCII character except ' ' (space) and ':' (colon). The pattern for the egrep command is changed to match all of these characters. Signed-off-by: Christian Himpel <chressie@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | am/mailinfo: Disable scissors processing by defaultJunio C Hamano2009-08-26
| | | | | | | | | | | | You can enable it by giving --scissors to "git am". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'gb/apply-ignore-whitespace'Junio C Hamano2009-08-21
|\ \ | | | | | | | | | | | | * gb/apply-ignore-whitespace: git apply: option to ignore whitespace differences
| * | git apply: option to ignore whitespace differencesGiuseppe Bilotta2009-08-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce --ignore-whitespace option and corresponding config bool to ignore whitespace differences while applying patches, akin to the 'patch' program. 'git am', 'git rebase' and the bash git completion are made aware of this option. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'bc/mailsplit-cr-at-eol'Junio C Hamano2009-08-21
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bc/mailsplit-cr-at-eol: Allow mailsplit (and hence git-am) to handle mails with CRLF line-endings builtin-mailsplit.c: remove read_line_with_nul() since it is no longer used builtin-mailinfo,builtin-mailsplit: use strbufs strbuf: add new function strbuf_getwholeline()
| * | | Allow mailsplit (and hence git-am) to handle mails with CRLF line-endingsJunio C Hamano2009-08-05
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is not that uncommon to have mails with DOS line-ending, notably Thunderbird and web mailers like Gmail (when saving what they call "original" message). So modify mailsplit to convert CRLF line-endings to just LF. Since git-rebase is built on top of git-am, add an option to mailsplit to be used by git-am when it is acting on behalf of git-rebase, to refrain from doing this conversion. And add a test to make sure that rebase still works. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | git-am: print fair error message when format detection failsNicolas Sebrecht2009-08-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid git ending with this message: "Patch format is not supported." With improved error message in the format detection failure case by Giuseppe Bilotta. Signed-off-by: Nicolas Sebrecht <ni.s@laposte.net> Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | am: allow individual e-mail files as inputJunio C Hamano2009-08-06
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We traditionally allowed a mbox file or a directory name of a maildir (but never an individual file inside a maildir) to be given to "git am". Even though an individual file in a maildir (or more generally, a piece of RFC2822 e-mail) is not a mbox file, it contains enough information to create a commit out of it, so there is no reason to reject one. Running mailsplit on such a file feels stupid, but it does not hurt. This builds on top of a5a6755 (git-am foreign patch support: introduce patch_format, 2009-05-27) that introduced mailbox format detection. The codepath to deal with a mbox requires it to begin with "From " line and also allows it to begin with "From: ", but a random piece of e-mail can and often do begin with any valid RFC2822 header lines. Instead of checking the first line, we extract all the lines up to the first empty line, and make sure they look like e-mail headers. A test is added to t4150 to demonstrate this feature. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'gb/am-foreign'Junio C Hamano2009-07-06
|\ \ | | | | | | | | | | | | | | | | | | | | | * gb/am-foreign: git-am: refactor 'cleaning up and aborting' git-am foreign patch support: StGIT support git-am foreign patch support: autodetect some patch formats git-am foreign patch support: introduce patch_format
| * | git-am: refactor 'cleaning up and aborting'Giuseppe Bilotta2009-06-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a clean_abort function that echoes an optional error message to standard error, removes the dotest directory and exits with status 1. Use it when patch format detection or patch splitting fails early. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git-am foreign patch support: StGIT supportGiuseppe Bilotta2009-05-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support StGIT patches by implementing a simple perl-based converter mimicking StGIT's own parse_patch. Also support StGIT patch series by 'exploding' the index into a list of files and re-running the mail splitting with patch_format set to stgit. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git-am foreign patch support: autodetect some patch formatsGiuseppe Bilotta2009-05-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default to mbox format if input is from stdin. Otherwise, look at the first few lines of the first patch to try to guess its format. Include checks for mailboxes, stgit patch series, stgit single patches and hg patches. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git-am foreign patch support: introduce patch_formatGiuseppe Bilotta2009-05-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | Set up a framework to allow git-am to support patches which are not in mailbox format. Introduce a patch_format variable that presently can only be set from the command line, defaulting to 'mbox' (the only supported format) if not specified. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | am, rebase: teach quiet optionStephen Boyd2009-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git-am and git-rebase are talkative scripts. Teach them to be quiet when told, allowing them to speak only when they fail or experience errors. The quiet option is maintained when git-am or git-rebase fails to apply a patch. This means subsequent --resolved, --continue, --skip, --abort invocations will be quiet if the original invocation was quiet. Drop a handful of >&2 redirection; the rest of the program sends all the info messages to stdout, not to stderr. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | am: suppress apply errors when using 3-wayStephen Boyd2009-06-18
|/ / | | | | | | | | | | | | | | | | | | git-am with 3-way outputs errors when applying, even though the 3-way will usually be successful. We suppress these errors from git-apply because they are not "true" errors until the 3-way has been attempted. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | am: simplify "sq" function by using "git rev-parse --sq-quote"Christian Couder2009-05-10
| | | | | | | | | | Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Work around ash "alternate value" expansion bugBen Jackson2009-04-18
| | | | | | | | | | | | | | | | | | | | Ash (used as /bin/sh on many distros) has a shell expansion bug for the form ${var:+word word}. The result is a single argument "word word". Work around by using ${var:+word} ${var:+word} or equivalent. Signed-off-by: Ben Jackson <ben@ben.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: teach git-am to apply a patch to an unborn branchNanako Shiraishi2009-04-12
| | | | | | | | | | | | | | | | People sometimes wonder why they cannot apply a patch that only creates new files to an unborn branch. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: make --abort less dangerousJunio C Hamano2009-02-26
| | | | | | | | | | | | | | | | | | | | When you are in the middle of "git rebase", "git am --abort" by mistake would have referred to nonexistent ORIG_HEAD and barfed, or worse yet, used a stale ORIG_HEAD and taken you to an unexpected commit. Also the option parsing did not reject "git am --abort --skip". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: Keep index in case of abort with dirty indexMichael J Gruber2009-02-26
| | | | | | | | | | | | | | | | | | git am --abort resets the index unconditionally. But in case a previous git am exited due to a dirty index it is preferable to keep that index. Make it so. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ns/am-slacker'Junio C Hamano2009-02-04
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * ns/am-slacker: git-am: Add --ignore-date option am: Add --committer-date-is-author-date option Conflicts: git-am.sh
| * | git-am: Add --ignore-date optionNanako Shiraishi2009-01-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new option tells 'git-am' to ignore the date header field recorded in the format-patch output. The commits will have the timestamp when they are created instead. You can work a lot in one day to accumulate many changes, but apply and push to the public repository only some of them at the end of the first day. Then next day you can spend all your working hours reading comics or chatting with your coworkers, and apply your remaining patches from the previous day using this option to pretend that you have been working at the end of the day. Signed-off-by: しらいしななこ <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | am: Add --committer-date-is-author-date optionJunio C Hamano2009-01-25
| | | | | | | | | | | | | | | | | | | | | | | | This new option tells 'git-am' to use the timestamp recorded in the Email message as both author and committer date. Signed-off-by: しらいしななこ <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | git-am: minor cleanupsJay Soffian2009-01-28
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update usage statement to remove a no-longer supported option, and to hide two options (one a no-op, one internal) unless --help-all is used. Use "test -t 0" instead of "tty -s" to detect when stdin is a terminal. (test -t 0 is used elsewhere in git-am and in other git shell scripts, tty -s is not, and appears to be deprecated by POSIX) Use "test ..." instead of "[ ... ]" and "die <msg>" instead of "echo <msg> >&2; exit 1" to be consistent with rest of script. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: implement --reject option passed to git-applymartin f. krafft2009-01-23
| | | | | | | | | | | | | | | | With --reject, git-am simply passes the --reject option to git-apply and thus allows people to work with reject files if they so prefer. Signed-off-by: martin f. krafft <madduck@madduck.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jf/am-failure-report'Junio C Hamano2009-01-21
|\ \ | | | | | | | | | | | | | | | * jf/am-failure-report: git-am: re-fix the diag message printing git-am: Make it easier to see which patch failed
| * | git-am: re-fix the diag message printingJunio C Hamano2009-01-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | The $FIRSTLINE variable is from the user's commit and can contain arbitrary backslash escapes that may be (mis)interpreted when given to "echo", depending on the implementation. Use "printf" to work around the issue. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git-am: Make it easier to see which patch failedJonas Flodén2009-01-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When git-am fails it's not always easy to see which patch failed, since it's often hidden by a lot of error messages. Add an extra line which prints the name of the failed patch just before the resolve message to make it easier to find. Signed-off-by: Jonas Flodén <jonas@floden.nu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | git-am: fix shell quotingJunio C Hamano2009-01-14
| | | | | | | | | | | | | | | | | | Noticed by Stephan Beyer; the new test is mine. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | git-am: add --directory=<dir> optionJunio C Hamano2009-01-12
|/ / | | | | | | | | | | | | | | | | | | | | | | Thanks to a200337 (git-am: propagate -C<n>, -p<n> options as well, 2008-12-04) and commits around it, "git am" is equipped to correctly propagate the command line flags such as -C/-p/-whitespace across a patch failure and restart. It is trivial to support --directory option now, resurrecting previous attempts by Kevin and Simon. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: rename apply_opt_extra file to apply-optJunio C Hamano2008-12-05
| | | | | | | | | | | | | | All other state files use dash in their names, not underscores. Also, there is no reason to call this "extra". Drop it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: propagate --3way options as wellJunio C Hamano2008-12-04
| | | | | | | | | | | | | | The reasoning is the same as the previous patch, where we made -C<n> and -p<n> propagate across a failure. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: propagate -C<n>, -p<n> options as wellJunio C Hamano2008-12-04
| | | | | | | | | | | | | | | | | | | | | | | | These options are meant to deal with patches that do not apply cleanly due to the differences between the version the patch was based on and the version "git am" is working on. Because a series of patches applied in the same "git am" run tends to come from the same source, it is more useful to propagate these options after the application stops. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am --whitespace: do not lose the command line optionJunio C Hamano2008-12-04
|/ | | | | | | | | | | | | When you start "git am --whitespace=fix" and the patch application process is interrupted by an unapplicable patch early in the series, after fixing the offending patch, the remainder of the patch should be processed still with --whitespace=fix when restarted with "git am --resolved" (or dropping the offending patch with "git am --skip"). The breakage was introduced by the commit 67dad68 (add -C[NUM] to git-am, 2007-02-08); this should fix it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-am: ignore --binary optionStephan Beyer2008-08-16
| | | | | | | | | The git-apply documentation says that --binary is a historical option. This patch lets git-am ignore --binary and removes advertisements of this option. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Replace uses of "git-var" with "git var"Todd Zullinger2008-07-30
| | | | | Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-am: Mention --abort in usage string part of OPTIONS_SPECStephan Beyer2008-07-25
| | | | | | | | | The three separate lines for --skip, --resolved and --abort are merged into one so that it is easy to see that they're alternative and related options. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-am: Add colon before the subject that is printed out as being appliedStephan Beyer2008-07-23
| | | | | | | | | git-am output can be confusing, because the subject of the applied patch can look like the rest of a sentence starting with "Applying". The added colon should make this clearer. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git am --skip: clean the index while preserving local changesOlivier Marin2008-07-22
| | | | | | | | | | | | In 3-way merge, "am" will let the index with unmerged path waiting for us to resolve conflicts and continue. But if we want to --skip instead, "am" refuses to continue because of the dirty index. With this patch, "am" will clean the index without touching files locally modified, before continuing. Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-am: remove dash from help messageOlivier Marin2008-07-21
| | | | | Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Rename .git/rebase to .git/rebase-applyJohannes Schindelin2008-07-21
| | | | | | | | | | With git-am, it sounds awkward to have the patches in ".git/rebase/", but for technical reasons, we have to keep the same directory name for git-am and git-rebase. ".git/rebase-apply" seems to be a good compromise. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'ns/am-abort'Junio C Hamano2008-07-20
|\ | | | | | | | | * ns/am-abort: git am --abort