summaryrefslogtreecommitdiff
path: root/git-am.sh
AgeCommit message (Collapse)AuthorFilesLines
2013-06-17am: handle stray $dotest directoryLibravatar Ramkumar Ramachandra1-0/+17
The following bug has been observed: $ git am # no input file ^C $ git am --abort Resolve operation not in progress, we are not resuming. This happens because the following test fails: test -d "$dotest" && test -f "$dotest/last" && test -f "$dotest/next" and the codepath for an "am in-progress" is not executed. It falls back to the codepath that treats this as a "fresh execution". Before rr/rebase-autostash, this condition was test -d "$dotest" It would incorrectly execute the "normal" am --abort codepath: git read-tree --reset -u HEAD ORIG_HEAD git reset ORIG_HEAD by incorrectly assuming that an am is "in progress" (i.e. ORIG_HEAD etc. was written during the previous execution). Notice that $ git am ^C executes nothing of significance, is equivalent to $ mkdir .git/rebase-apply Therefore, the correct solution is to treat .git/rebase-apply as a "stray directory" and remove it on --abort in the fresh-execution codepath. Also ensure that we're not called with --rebasing from git-rebase--am.sh; in that case, it is the responsibility of the caller to handle and stray directories. While at it, tell the user to run "git am --abort" to get rid of the stray $dotest directory, if she attempts anything else. Reported-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-12am: return control to caller, for housekeepingLibravatar Ramkumar Ramachandra1-2/+7
We only need to do these two tasks git gc --auto rm -fr "$dotest" ourselves if the script was invoked as a standalone program; when invoked with --rebasing (from git-rebase--am.sh), cascade control back to the ultimate caller git-rebase.sh to do this for us. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-12am: tighten a conditional that checks for $dotestLibravatar Ramkumar Ramachandra1-1/+3
In preparation for a later patch that creates $dotest/autostash in git-rebase.sh before anything else happens, don't assume that the presence of a $dotest directory implies the existence of the $dotest/next and $dotest/last files. Look for them explicitly. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-21git-am: show the final log message on "Applying:" indicatorLibravatar Simon Ruderich1-7/+7
The "Applying:" message "git am" shows to tell the user which patch is being applied has traditionally been to help identifying the input, but we started showing the edited result since f23272f3fd84 (git-am -i: report rewritten title, 2007-12-04), because it was found more confusing to show the original during an interactive session. Treat the modification by the applypatch-msg hook in a similar way and use the edited result in the progress indication, even though this is usually not interactive. Signed-off-by: Simon Ruderich <simon@ruderich.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05Merge branch 'jc/fake-ancestor-with-non-blobs'Libravatar Junio C Hamano1-1/+1
Rebasing the history of superproject with change in the submodule was broken since v1.7.12. * jc/fake-ancestor-with-non-blobs: apply: diagnose incomplete submodule object name better apply: simplify build_fake_ancestor() git-am: record full index line in the patch used while rebasing
2013-01-31git-am: record full index line in the patch used while rebasingLibravatar Junio C Hamano1-1/+1
Earlier, a230949 (am --rebasing: get patch body from commit, not from mailbox, 2012-06-26) learned to regenerate patch body from the commit object while rebasing, instead of reading from the rebase-am front-end. While doing so, it used "git diff-tree" but without giving it the "--full-index" option. This does not matter for in-repository objects; during rebasing, any abbreviated object name should uniquely identify them. But we may be rebasing a commit that contains a change to a gitlink, in which case we usually should not have the object (it names a commit in the submodule). A full object name is necessary to later reconstruct a fake ancestor index for them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-28Merge branch 'dl/am-hg-locale'Libravatar Junio C Hamano1-1/+1
Datestamp recorded in "Hg" format patch was reformatted incorrectly to an e-mail looking date using locale dependant strftime, causing patch application to fail. * dl/am-hg-locale: am: invoke perl's strftime in C locale
2013-01-18am: invoke perl's strftime in C localeLibravatar Dmitry V. Levin1-1/+1
We used to convert timestamps in metadata comment of Hg patch to mbox-looking Date: field using strftime, without making sure the resulting string is not translated. Always use C locale for this. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-07Merge branch 'nd/am-i18n-fix'Libravatar Junio C Hamano1-2/+2
"git am" wasn't marked up for i18n properly. * nd/am-i18n-fix: am: quote string for translation before passing to eval_gettextln
2012-08-22am: quote string for translation before passing to eval_gettextlnLibravatar Nguyễn Thái Ngọc Duy1-2/+2
If it's not quoted, the string is expanded before it gets looked up in gettext database and obviously nothing is returned. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-31Merge branch 'jx/i18n-1.7.11'Libravatar Junio C Hamano1-12/+8
Add i18n support for scripted Porcelains, and mark strings in merge(-recursive), am, and rebase for i18n. * jx/i18n-1.7.11: i18n: merge-recursive: mark strings for translation Remove dead code which contains bad gettext block i18n: am: mark more strings for translation rebase: remove obsolete and unused LONG_USAGE which breaks xgettext i18n: Rewrite gettext messages start with dash i18n: rebase: mark messages for translation i18n: New keywords for xgettext extraction from sh
2012-07-26Remove dead code which contains bad gettext blockLibravatar Jiang Xin1-3/+0
Found this dead code when I examine gettext messages in shell scripts start with dash ('-' or '--'). An error will be raised for this case, like: $ gettext "-d option is no longer supported. Do not use." gettext: missing arguments Indead, this code has been left as dead for a long time, as Jonathan points out: The git am -d/--dotest option has errored out with a message since e72c7406 (am: remove support for -d .dotest, 2008-03-04). The error message about lack of support was eliminated along with other cleanups (probably by mistake) a year later by removing the option from the option table in 98ef23b3 (git-am: minor cleanups, 2009-01-28). But the code to handle -d and --dotest stayed around even though ever since then it could not be tripped. Remove this dead code. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Reviewed-by: Stefano Lattarini <stefano.lattarini@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-26i18n: am: mark more strings for translationLibravatar Jiang Xin1-6/+5
Mark strings in 'git-am.sh' for translation. In the last chunk, change '$1' to '-b/--binary', as it is not worth turning this message to "The %s option has been..." and using printf on it. Also reduce one indentation level for one gettextln clause introduced in commit de88c1c. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Reviewed-by: Stefano Lattarini <stefano.lattarini@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-25i18n: rebase: mark messages for translationLibravatar Jiang Xin1-3/+3
Mark messages in git-rebase.sh for translation. While doing this Jonathan noticed that the comma usage and sentence structure of the resolvemsg was not quite right, so correct that and its cousins in git-am.sh and t/t0201-gettext-fallbacks.sh at the same time. Some tests would start to fail with GETTEXT_POISON turned on after this update. Use test_i18ncmp and test_i18ngrep where appropriate to mark strings that should only be checked in the C locale output to avoid such issues. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Reviewed-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-22Merge branch 'pg/maint-1.7.9-am-where-is-patch'Libravatar Junio C Hamano1-0/+5
When "git am" failed, old timers knew to check .git/rebase-apply/patch to see what went wrong, but we never told the users about it. * pg/maint-1.7.9-am-where-is-patch: am: indicate where a failed patch is to be found
2012-07-13am: indicate where a failed patch is to be foundLibravatar Paul Gortmaker1-0/+5
If "git am" fails to apply something, the end user may need to know where to find the patch that failed to apply, so that the user can do other things (e.g. trying "GNU patch" on it, running "diffstat" to see what it tried to change, etc.) The input to "am" may have contained more than one patch, or the message may have been MIME encoded, and knowing what the user fed to "am" does not help very much for this purpose. Also introduce advice.amworkdir configuration to allow people who learned where to look to squelch this message. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-26am: don't call mailinfo if $rebasingLibravatar Martin von Zweigbergk1-23/+24
Since 5e835ca (rebase: do not munge commit log message, 2008-04-16), 'git am --rebasing' no longer gets the commit log message from the patch, but reads it from the commit identified by the "From " header line. From 43c2325 (am: use get_author_ident_from_commit instead of mailinfo when rebasing, 2010-06-16), it also gets the author name, email and date from the commit. Now that the final part of the patch -- the patch body itself -- is also read from the commit, there is no longer a need to call 'git mailinfo' to extract any of these parts while --rebasing. Sugested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-26am --rebasing: get patch body from commit, not from mailboxLibravatar Martin von Zweigbergk1-0/+1
Rebasing a commit that contains a diff in the commit message results in a failure with output such as First, rewinding head to replay your work on top of it... Applying: My cool patch. fatal: sha1 information is lacking or useless (app/controllers/settings_controller.rb). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 My cool patch. The reason is that 'git rebase' without -p/-i/-m internally calls 'git format-patch' and pipes the output to 'git am --rebasing', which has no way of knowing what is a real patch and what is a commit message that contains a patch. Make 'git am' while in --rebasing mode get the patch body from the commit object instead of extracting it from the mailbox. Patch by Junio, test case and commit log message by Martin. Reported-by: anikey <arty.anikey@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-20Merge branch 'jc/am-report-3way'Libravatar Junio C Hamano1-0/+6
When "git am -3" needs to fall back to an application to a synthesized preimage followed by a 3-way merge, the paths that needed such treatment are now reported to the end user, so that the result in them can be eyeballed with extra care. * jc/am-report-3way: am -3: list the paths that needed 3-way fallback
2012-04-20Merge branch 'jb/am-include'Libravatar Junio C Hamano1-1/+2
"git am" learned the "--include" option, which is an opposite of existing the "--exclude" option. By Johannes Berg * jb/am-include: am: support --include option
2012-03-28am: support --include optionLibravatar Johannes Berg1-1/+2
am supports a number of pass-through options to apply, like --exclude and --directory. Add --include to this list. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-28am -3: list the paths that needed 3-way fallbackLibravatar Junio C Hamano1-0/+6
When applying a patch that was based on an older release with "am -3", I often wonder changes to which files need to be reviewed with extra care to spot mismerges, but there is no good indication. The paths that needed 3-way fallback can easily be obtained by comparing the synthesized (partial) base tree and the current HEAD and noticing only additions and modifications (removals only show the sparseness of the fake ancestor tree, which is not useful information at all). List them in the usual --name-status format. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-13am: officially deprecate -b/--binary optionLibravatar Junio C Hamano1-2/+2
We have had these options as harmless no-op for more than 3 years without officially deprecating them. Let's announce the deprecation and start warning against their use, but without failing the command just not yet, so that we can later repurpose the option if we want to in the future. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-12Merge branch 'jc/am-3-nonstandard-popt' into maintLibravatar Junio C Hamano1-4/+7
The code to synthesize the fake ancestor tree used by 3-way merge fallback in "git am" was not prepared to read a patch created with a non-standard -p<num> value. * jc/am-3-nonstandard-popt: test: "am -3" can accept non-standard -p<num> am -3: allow nonstandard -p<num> option
2012-03-12git-am: error out when seeing -b/--binaryLibravatar Thomas Rast1-1/+3
The --binary option to git-apply has been a no-op since 2b6eef9 (Make apply --binary a no-op., 2006-09-06) and was deprecated in cb3a160 (git-am: ignore --binary option, 2008-08-09). We could remove it outright, but let's be nice to people who still have scripts saying 'git am -b' (if they exist) and tell them the reason for the sudden failure. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-04Merge branch 'jc/am-3-nonstandard-popt'Libravatar Junio C Hamano1-4/+7
* jc/am-3-nonstandard-popt: test: "am -3" can accept non-standard -p<num> am -3: allow nonstandard -p<num> option
2012-02-26Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: Document accumulated fixes since 1.7.9.2 Git 1.7.8.5 grep -P: Fix matching ^ and $ am: don't infloop for an empty input file rebase -m: only call "notes copy" when rewritten exists and is non-empty git-p4: remove bash-ism in t9800 git-p4: remove bash-ism in t9809 git-p4: fix submit regression with clientSpec and subdir clone git-p4: set useClientSpec variable on initial clone Makefile: add thread-utils.h to LIB_H Conflicts: RelNotes t/t9809-git-p4-client-view.sh
2012-02-26am: don't infloop for an empty input fileLibravatar Jim Meyering1-1/+1
git-am.sh's check_patch_format function would attempt to preview the patch to guess its format, but would go into an infinite loop when the patch file happened to be empty. The solution: exit the loop when "read" fails, not when the line var, "$l1" becomes empty. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-22am -3: allow nonstandard -p<num> optionLibravatar Junio C Hamano1-4/+7
When falling back to 3-way merge, we run "git apply" to synthesize the fake ancestor tree by parsing the incoming patch, and another "git apply" to apply the patch to the fake ancestor tree. Both invocation need to be aware of the custom -p<num> setting to parse patches that were prepared with non-standard src/dst prefix. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-29Merge branch 'tr/maint-mailinfo'Libravatar Junio C Hamano1-4/+16
* tr/maint-mailinfo: mailinfo: with -b, keep space after [foo] am: learn passing -b to mailinfo Conflicts: git-am.sh
2012-01-16am: learn passing -b to mailinfoLibravatar Thomas Rast1-4/+16
git-am could pass -k to mailinfo, but not -b. Introduce an option that does so. We change the meaning of the 'keep' state file, but are careful not to cause a problem unless you downgrade in the middle of an 'am' run. This uncovers a bug in mailinfo -b, hence the failing test. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-09Merge branch 'maint-1.7.7' into maintLibravatar Junio C Hamano1-7/+0
* maint-1.7.7: am: don't persist keepcr flag mingw: give waitpid the correct signature git symbolic-ref: documentation fix
2011-12-09am: don't persist keepcr flagLibravatar Martin von Zweigbergk1-7/+0
The keepcr flag is only used in the split_patches function, which is only called before a patch application has to stopped for user input, not after resuming. It is therefore unnecessary to persist the flag. This seems to have been the case since it was introduced in ad2c928 (git-am: Add command line parameter `--keep-cr` passing it to git-mailsplit, 2010-02-27). Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05Merge branch 'gb/am-hg-patch'Libravatar Junio C Hamano1-0/+34
* gb/am-hg-patch: am: preliminary support for hg patches
2011-09-02Merge branch 'gb/maint-am-stgit-author-to-from-fix'Libravatar Junio C Hamano1-1/+1
* gb/maint-am-stgit-author-to-from-fix: am: fix stgit patch mangling
2011-09-02Merge branch 'gb/maint-am-patch-format-error-message'Libravatar Junio C Hamano1-1/+2
* gb/maint-am-patch-format-error-message: am: format is in $patch_format, not parse_patch Conflicts: git-am.sh
2011-08-29am: preliminary support for hg patchesLibravatar Giuseppe Bilotta1-0/+34
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-29am: fix stgit patch manglingLibravatar Giuseppe Bilotta1-1/+1
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-29am: format is in $patch_format, not parse_patchLibravatar Giuseppe Bilotta1-1/+2
The error message given when the patch format was not recognized was wrong, since the variable checked was $parse_patch rather than $patch_format. Fix by checking the non-emptyness of the correct variable. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-25Merge branch 'js/i18n-scripts'Libravatar Junio C Hamano1-17/+14
* js/i18n-scripts: submodule: take advantage of gettextln and eval_gettextln. stash: take advantage of eval_gettextln pull: take advantage of eval_gettextln git-am: take advantage of gettextln and eval_gettextln. gettext: add gettextln, eval_gettextln to encode common idiom
2011-08-18Merge branch 'db/am-skip-blank-at-the-beginning'Libravatar Junio C Hamano1-3/+8
* db/am-skip-blank-at-the-beginning: am: ignore leading whitespace before patch
2011-08-18Merge branch 'ma/am-exclude'Libravatar Junio C Hamano1-1/+2
* ma/am-exclude: am: Document new --exclude=<path> option am: pass exclude down to apply
2011-08-16Merge branch 'maint'Libravatar Junio C Hamano1-0/+2
* maint: Prepare for 1.7.6.1 am: refresh the index at start and --resolved Conflicts: GIT-VERSION-GEN RelNotes
2011-08-16am: refresh the index at start and --resolvedLibravatar Jeff King1-0/+2
If a file is unchanged but stat-dirty, we may erroneously fail to apply patches, thinking that they conflict with a dirty working tree. This patch adds a call to "update-index --refresh". It comes as late as possible, so that we don't bother with it for thinks like "git rebase --abort", or when mbox-splitting fails. However, it does come before we actually start applying patches, meaning we will only call it once when we start applying patches (or any time we return to "am" after having resolved conflicts), and not once per patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11am: ignore leading whitespace before patchLibravatar David Barr1-3/+8
Some web-based email clients prepend whitespace to raw message transcripts to workaround content-sniffing in some browsers. Adjust the patch format detection logic to ignore leading whitespace. So now you can apply patches from GMail with "git am" in three steps: 1. choose "show original" 2. tell the browser to "save as" (for example by pressing Ctrl+S) 3. run "git am" on the saved file This fixes a regression introduced by v1.6.4-rc0~15^2~2 (git-am foreign patch support: autodetect some patch formats, 2009-05-27). GMail support was first introduced to "git am" by v1.5.4-rc0~274^2 (Make mailsplit and mailinfo strip whitespace from the start of the input, 2007-11-01). Signed-off-by: David Barr <davidbarr@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-08git-am: take advantage of gettextln and eval_gettextln.Libravatar Jon Seymour1-17/+14
Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03am: pass exclude down to applyLibravatar maximilian attems1-1/+2
This allows to pass patches around from repositories, where the other repository doesn't feature certain files. In the special case this works for dash git sync to klibc dash: git am --directory="usr/dash" --exclude="usr/dash/configure.ac" \ --exclude="usr/dash/ChangeLog" --exclude="usr/dash/dash.1" \ .. -i -s -k ../dash/000X-foo.patch Signed-off-by: maximilian attems <max@stro.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-am printf(1) message to eval_gettextLibravatar Ævar Arnfjörð Bjarmason1-1/+1
Convert a message that used printf(1) format to use eval_gettext. It's easier for translators to handle the latter, since the eval format automatically gives them context via variable names. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-am core say messagesLibravatar Ævar Arnfjörð Bjarmason1-3/+3
Make the core git-am messages that use say() translatable. These are visible on almost every git am invocation. There are tests that depend on the "Applying" output that need to be changed to use the test_i18* functions along with this translation. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-21i18n: git-am "Falling back" say messageLibravatar Ævar Arnfjörð Bjarmason1-1/+1
Make the "Falling back to patching base and 3-way merge..." message used by fall_back_3way() translatable. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>