path: root/
AgeCommit message (Collapse)Author
2010-06-27Merge branch 'js/maint-am-rebase-invalid-author'Junio C Hamano
* js/maint-am-rebase-invalid-author: am: use get_author_ident_from_commit instead of mailinfo when rebasing
2010-06-18Merge branch 'rr/am-help'Junio C Hamano
* rr/am-help: git am: Remove stray error message from sed git am: Display some help text when patch is empty git am: Set cmdline globally
2010-06-16am: use get_author_ident_from_commit instead of mailinfo when rebasingJay Soffian
In certain situations, commit authorship can consist of an invalid e-mail address. For example, this is the case when working with git svn repos where the author email has had the svn repo UUID appended such as: <> Given such an address, mailinfo extracts the authorship incorrectly as it assumes a valid domain. However, when rebasing the original authorship should be preserved irrespective of its validity as an email address. Using get_author_ident_from_commit instead of mailinfo when rebasing preserves the original authorship. Signed-off-by: Jay Soffian <> Signed-off-by: Junio C Hamano <>
2010-06-02git am: Remove stray error message from sedRamkumar Ramachandra
When --continue is invoked without any changes, the following stray error message appears- sed: can't read $dotest/final-commit: No such file or directory. Remove this by making sure that the file actually exists. Signed-off-by: Ramkumar Ramachandra <> Signed-off-by: Junio C Hamano <>
2010-06-02git am: Display some help text when patch is emptyRamkumar Ramachandra
When a patch is found to be empty, prompt the user to use either --skip or --abort. Signed-off-by: Ramkumar Ramachandra <> Signed-off-by: Junio C Hamano <>
2010-06-02git am: Set cmdline globallyRamkumar Ramachandra
Set the $cmdline variable globally, and not in stop_here_user_resolve so it can be used in other code fragments as well. Signed-off-by: Ramkumar Ramachandra <> Signed-off-by: Junio C Hamano <>
2010-06-01git-am: suggest what to do with superfluous patchesJan Krüger
Particularly in the context of rebase, conflicts frequently occur because the change in the patch to be applied was made obsolete by new upstream commits. In this case, solving the conflict effectively means skipping the patch. However, it's not always readily apparent that the patch needs to be skipped, and when people solve the conflict and try git rebase --continue, they get confronted with a message of No changes - did you forget to use 'git add'? That's not very helpful if you did actually stage your changes and they happen to turn the patch into a no-op. This extends the message to point out what's going on. Signed-off-by: Jan Krüger <> Signed-off-by: Junio C Hamano <>
2010-05-21Merge branch 'jc/am-3-show-corrupted-patch'Junio C Hamano
* jc/am-3-show-corrupted-patch: am -3: recover the diagnostic messages for corrupt patches
2010-04-14am -3: recover the diagnostic messages for corrupt patchesJunio C Hamano
"git am -3" first tries to apply the patch without any extra trick, and applies it to a synthesized tree for 3-way merge after the first attempt fails. "git apply" exits with status 1 for a patch that is well-formed but is not applicable (and it dies on other errors with non-zereo, non-1 status) and has an optimization to fall back to the 3-way merge only in the case. An earlier patch 3ddd170 (am: suppress apply errors when using 3-way, 2009-06-16) squelched diagnostic messages from the first attempt, not to be shown to the end user. This worked reasonably well if the reason the first application failed was because the patch was made against a wrong version. When the patch is corrupt (e.g. line-wrapped or leading whitespaces got dropped), however, because the second patch application is not even attempted, the error message from the first application is never shown and is forever lost. This message is necessary to locate where the patch is corrupt and fix it up. We could fix this issue by reverting 3dd170, or keeping the error message to somewhere and showing it, but because this is an error codepath, the easiest is to disable the optimization. The second patch application is attempted even when the input is corrupt, and it will notice, diagnose, and stop with an error message. Signed-off-by: Junio C Hamano <>
2010-03-24Merge branch 'tr/notes-display'Junio C Hamano
* tr/notes-display: git-notes(1): add a section about the meaning of history notes: track whether notes_trees were changed at all notes: add shorthand --ref to override GIT_NOTES_REF commit --amend: copy notes to the new commit rebase: support automatic notes copying notes: implement helpers needed for note copying during rewrite notes: implement 'git notes copy --stdin' rebase -i: invoke post-rewrite hook rebase: invoke post-rewrite hook commit --amend: invoke post-rewrite hook Documentation: document post-rewrite hook Support showing notes from more than one notes tree test-lib: unset GIT_NOTES_REF to stop it from influencing tests Conflicts: refs.c
2010-03-13rebase: support automatic notes copyingThomas Rast
Luckily, all the support already happens to be there. Signed-off-by: Thomas Rast <> Signed-off-by: Junio C Hamano <>
2010-03-13rebase: invoke post-rewrite hookThomas Rast
We have to deal with two separate code paths: a normal rebase, which actually goes through git-am; and rebase {-m|-s}. The only small issue with both is that they need to remember the original sha1 across a possible conflict resolution. rebase -m already puts this information in $dotest/current, and we just introduce a similar file for git-am. Note that in git-am, the hook really only runs when coming from git-rebase: the code path that sets the $dotest/original-commit file is guarded by a test for $dotest/rebasing. Signed-off-by: Thomas Rast <> Signed-off-by: Junio C Hamano <>
2010-03-10Merge branch 'sh/am-keep-cr'Junio C Hamano
* sh/am-keep-cr: git-am: Add tests for `--keep-cr`, `--no-keep-cr` and `am.keepcr` git-am: Add am.keepcr and --no-keep-cr to override it git-am: Add command line parameter `--keep-cr` passing it to git-mailsplit documentation: 'git-mailsplit --keep-cr' is not hidden anymore
2010-03-02Merge branch 'jn/maint-fix-pager'Junio C Hamano
* jn/maint-fix-pager: tests: Fix race condition in t7006-pager t7006-pager: if stdout is not a terminal, make a new one tests: Add tests for automatic use of pager am: Fix launching of pager git svn: Fix launching of pager git.1: Clarify the behavior of the --paginate option Make 'git var GIT_PAGER' always print the configured pager Fix 'git var' usage synopsis
2010-02-28git-am: Add am.keepcr and --no-keep-cr to override itStefan-W. Hahn
This patch adds the configuration `am.keepcr` for git-am. It also adds `--no-keep-cr` parameter for git-am to give the possibility to override configuration from command line. Signed-off-by: Stefan-W. Hahn <> Signed-off-by: Junio C Hamano <>
2010-02-28git-am: Add command line parameter `--keep-cr` passing it to git-mailsplitStefan-W. Hahn
c2ca1d7 (Allow mailsplit (and hence git-am) to handle mails with CRLF line-endings, 2009-08-04) fixed "git mailsplit" to help people with MUA whose output from save-as command uses CRLF as line terminators by stripping CR at the end of lines. However, when you know you are feeding output from "git format-patch" directly to "git am", and especially when your contents have CR at the end of line, such stripping is undesirable. To help such a use case, teach --keep-cr option to "git am" and pass that to "git mailinfo". Signed-off-by: Stefan-W. Hahn <> Signed-off-by: Junio C Hamano <>
2010-02-23am: remove rebase-apply directory before gcJonathan Nieder
When git am does an automatic gc it doesn't clean up the rebase-apply directory until after this has finished. This means that if the user aborts the gc then future am or rebase operations will report that an existing operation is in progress, which is undesirable and confusing. Reported by Mark Brown <> through Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-02-15am: Fix launching of pagerJonathan Nieder
The pagination functionality in git am has some problems: - It does not check if stdout is a tty, so it always paginates. - If $GIT_PAGER uses any environment variables, they are being ignored, since it does not run $GIT_PAGER through eval. - If $GIT_PAGER is set to the empty string, instead of passing output through to stdout, it tries to run $dotest/patch. Fix them. While at it, move the definition of git_pager() to git-sh-setup so authors of other commands are not tempted to reimplement it with the same mistakes. Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-02-12am: switch --resolved to --continueJeff King
Rebase calls this same function "--continue", which means users may be trained to type it. There is no reason to deprecate --resolved (or -r), so we will keep it as a synonym. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2010-01-26am: fix patch format detection for Thunderbird "Save As" emailsStephen Boyd
The patch detection wants to inspect all the headers of a rfc2822 message and ensure that they look like header fields. The headers are always separated from the message body with a blank line. When Thunderbird saves the message the blank line separating the headers from the body includes a CR. The patch detection is failing because a CRLF doesn't match /^$/. Fix this by allowing a CR to exist on the separating line. Signed-off-by: Stephen Boyd <> Signed-off-by: Junio C Hamano <>
2009-12-04Teach --[no-]rerere-autoupdate option to merge, revert and friendsJunio C Hamano
Introduce a command line option to override rerere.autoupdate configuration variable to make it more useful. Signed-off-by: Junio C Hamano <>
2009-11-30Merge branch 'jc/maint-am-keep'Junio C Hamano
2009-11-27Remove dead code from "git am"Junio C Hamano
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 <>
2009-11-25Merge branch 'rs/work-around-grep-opt-insanity'Junio C Hamano
* rs/work-around-grep-opt-insanity: Protect scripted Porcelains from GREP_OPTIONS insanity mergetool--lib: simplify guess_merge_tool() Conflicts:
2009-11-24Protect scripted Porcelains from GREP_OPTIONS insanityJunio C Hamano
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 <>
2009-11-23Merge branch 'ls/maint-mailinfo-no-inbody'Junio C Hamano
* ls/maint-mailinfo-no-inbody: git am/mailinfo: Don't look at in-body headers when rebasing
2009-11-21git am/mailinfo: Don't look at in-body headers when rebasingLukas Sandström
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 <> Signed-off-by: Junio C Hamano <>
2009-11-13am -i, git-svn: use "git var GIT_PAGER"Jonathan Nieder
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 <> Signed-off-by: Junio C Hamano <>
2009-09-25git-am: force egrep to use correct characters setChristian Himpel
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 <> Signed-off-by: Shawn O. Pearce <>
2009-09-25git-am: fixed patch_format detection according to RFC2822Christian Himpel
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 <> Signed-off-by: Shawn O. Pearce <>
2009-08-27am/mailinfo: Disable scissors processing by defaultJunio C Hamano
You can enable it by giving --scissors to "git am". Signed-off-by: Junio C Hamano <>
2009-08-22Merge branch 'gb/apply-ignore-whitespace'Junio C Hamano
* gb/apply-ignore-whitespace: git apply: option to ignore whitespace differences
2009-08-22Merge branch 'bc/mailsplit-cr-at-eol'Junio C Hamano
* 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()
2009-08-07git-am: print fair error message when format detection failsNicolas Sebrecht
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 <> Signed-off-by: Brandon Casey <> Signed-off-by: Junio C Hamano <>
2009-08-07am: allow individual e-mail files as inputJunio C Hamano
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 <> Signed-off-by: Brandon Casey <> Signed-off-by: Junio C Hamano <>
2009-08-05Allow mailsplit (and hence git-am) to handle mails with CRLF line-endingsJunio C Hamano
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 <> Signed-off-by: Junio C Hamano <>
2009-08-05git apply: option to ignore whitespace differencesGiuseppe Bilotta
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 <> Signed-off-by: Junio C Hamano <>
2009-07-06Merge branch 'gb/am-foreign'Junio C Hamano
* 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
2009-06-18am, rebase: teach quiet optionStephen Boyd
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 <> Signed-off-by: Junio C Hamano <>
2009-06-18am: suppress apply errors when using 3-wayStephen Boyd
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 <> Signed-off-by: Junio C Hamano <>
2009-06-14git-am: refactor 'cleaning up and aborting'Giuseppe Bilotta
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 <> Signed-off-by: Junio C Hamano <>
2009-05-29git-am foreign patch support: StGIT supportGiuseppe Bilotta
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 <> Signed-off-by: Junio C Hamano <>
2009-05-29git-am foreign patch support: autodetect some patch formatsGiuseppe Bilotta
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 <>
2009-05-29git-am foreign patch support: introduce patch_formatGiuseppe Bilotta
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 <>
2009-05-10am: simplify "sq" function by using "git rev-parse --sq-quote"Christian Couder
Signed-off-by: Christian Couder <> Signed-off-by: Junio C Hamano <>
2009-04-19Work around ash "alternate value" expansion bugBen Jackson
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 <> Signed-off-by: Junio C Hamano <>
2009-04-13git-am: teach git-am to apply a patch to an unborn branchNanako Shiraishi
People sometimes wonder why they cannot apply a patch that only creates new files to an unborn branch. Signed-off-by: Nanako Shiraishi <> Signed-off-by: Junio C Hamano <>
2009-02-27git-am: make --abort less dangerousJunio C Hamano
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 <>
2009-02-27git-am: Keep index in case of abort with dirty indexMichael J Gruber
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 <> Signed-off-by: Junio C Hamano <>
2009-02-04Merge branch 'ns/am-slacker'Junio C Hamano
* ns/am-slacker: git-am: Add --ignore-date option am: Add --committer-date-is-author-date option Conflicts: