summaryrefslogtreecommitdiff
path: root/git-am.sh
Commit message (Collapse)AuthorAgeFilesLines
* Work around ash "alternate value" expansion bugBen Jackson2009-04-181-1/+1
| | | | | | | | | | 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-121-5/+24
| | | | | | | | 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-261-0/+7
| | | | | | | | | | 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-261-3/+10
| | | | | | | | | 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-041-1/+20
|\ | | | | | | | | | | | | | | | | * 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-251-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-251-1/+12
| | | | | | | | | | | | | | | | 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-281-8/+4
|/ | | | | | | | | | | | | | | 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-231-0/+3
| | | | | | | | 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-211-1/+1
|\ | | | | | | | | | | * 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-181-1/+1
| | | | | | | | | | | | | | | | | | 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-171-1/+1
| | | | | | | | | | | | | | | | | | | | 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-141-1/+1
| | | | | | | | | | | | 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-121-4/+13
|/ | | | | | | | | | | | 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-051-2/+2
| | | | | | | 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-041-2/+7
| | | | | | | 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-041-7/+7
| | | | | | | | | | | | 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-041-4/+4
| | | | | | | | | | | | | 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-161-12/+7
| | | | | | | | | 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-301-1/+1
| | | | | 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-251-2/+1
| | | | | | | | | 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-231-1/+1
| | | | | | | | | 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-221-3/+9
| | | | | | | | | | | | 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-211-1/+1
| | | | | 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-211-1/+1
| | | | | | | | | | 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-201-4/+17
|\ | | | | | | | | * ns/am-abort: git am --abort
| * git am --abortNanako Shiraishi2008-07-191-4/+17
| | | | | | | | | | | | | | | | | | | | | | After failing to apply patches in the middle of a series, "git am --abort" lets you go back to the original commit. [jc: doc/help update from Olivier, and fixups for "am -3" squashed in] Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'sb/dashless'Junio C Hamano2008-07-161-3/+3
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | * sb/dashless: Make usage strings dash-less t/: Use "test_must_fail git" instead of "! git" t/test-lib.sh: exit with small negagive int is ok with test_must_fail Conflicts: builtin-blame.c builtin-mailinfo.c builtin-mailsplit.c builtin-shortlog.c git-am.sh t/t4150-am.sh t/t4200-rerere.sh
| * Make usage strings dash-lessStephan Beyer2008-07-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you misuse a git command, you are shown the usage string. But this is currently shown in the dashed form. So if you just copy what you see, it will not work, when the dashed form is no longer supported. This patch makes git commands show the dash-less version. For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh generates a dash-less usage string now. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"Johannes Schindelin2008-07-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | Since the files generated and used during a rebase are never to be tracked, they should live in $GIT_DIR. While at it, avoid the rather meaningless term "dotest" to "rebase", and unhide ".dotest-merge". This was wished for on the mailing list, but so far unimplemented. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jc/rebase-orig-head'Junio C Hamano2008-07-141-0/+1
|\ \ | | | | | | | | | | | | | | | * jc/rebase-orig-head: Documentation: mention ORIG_HEAD in am, merge, and rebase Teach "am" and "rebase" to mark the original position with ORIG_HEAD
| * | Teach "am" and "rebase" to mark the original position with ORIG_HEADJunio C Hamano2008-07-071-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "merge" and "reset" leave the original point in history in ORIG_HEAD, which makes it easy to go back to where you were before you inflict a major damage to your history and realize that you do not like the result at all. These days with reflog, we technically do not need to use ORIG_HEAD, but it is a handy way nevertheless. This teaches "am" and "rebase" (all forms --- the vanilla one that uses "am" as its backend, "-m" variant that cherry-picks, and "--interactive") to do the same. The original idea and a partial implementation to do this only for "rebase -m" was by Brian Gernhardt; this extends on his idea. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am/git-mailsplit: correct synopsis for reading from stdinStephan Beyer2008-07-131-1/+1
| | | | | | | | | | | | | | | | | | Invoking git-am or git-mailsplit without mbox or Maildir results in reading an mbox from stdin. Mention this in the synopsis and usage strings. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-am: Do not exit silently if committer is unsetStephan Beyer2008-07-131-1/+2
|/ | | | | Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-am: head -1 is obsolete and doesn't work on some new systemsAlejandro Mery2008-06-171-1/+1
| | | | | | | | | | | head -<n> was deprecated by POSIX, and as modern versions of coreutils package don't support it at least one exports _POSIX2_VERSION=199209 it's fails on some systems. head -n<n> is portable, but sed <n>q is even more. Signed-off-by: Alejandro Mery <amery@geeks.cl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-05-211-1/+1
|\ | | | | | | | | | | * maint-1.5.4: git-am: fix typo in usage message doc/git-daemon: s/uploadarchive/uploadarch/
| * git-am: fix typo in usage messageJeff King2008-05-191-1/+1
| | | | | | | | | | Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jc/maint-rebase-am' into maintJunio C Hamano2008-04-191-5/+14
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * jc/maint-rebase-am: rebase: do not munge commit log message Conflicts: git-am.sh
| * | rebase: do not munge commit log messageJunio C Hamano2008-04-161-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally git-rebase was implemented in terms of "format-patch" piped to "am -3", to strike balance between speed (because it avoids a rather expensive read-tree/merge-recursive machinery most of the time) and flexibility (the magic "-3" allows it to fall back to 3-way merge as necessary). However, this combination has one flaw when dealing with a nonstandard commit log message format that has more than one lines in the first paragraph. This teaches "git am --rebasing" to take advantage of the fact that the mbox message "git rebase" prepares for it records the original commit object name, to get the log message from the original commit object instead. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-04-181-1/+1
|\ \ \ | | |/ | |/| | | | | | | * maint-1.5.4: am: POSIX portability fix
| * | am: POSIX portability fixJunio C Hamano2008-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX allows echo without flag to interpret specials such as \n, and we tried to make things portable by using printf instead where it matters. Recently added code to "git am" had unprotected "echo", which was caught by t4014 and Rémi Vanicat. This should fix it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-04-161-2/+1
|\ \ \ | |/ / | | / | |/ |/| | | * maint-1.5.4: git-am: minor cleanup Clarify and fix English in "git-rm" documentation
| * git-am: minor cleanupJunio C Hamano2008-04-161-2/+1
| | | | | | | | | | | | | | | | | | This moves the assignment to FIRSTLINE down so that we do not have to have multiple copies. Suggested by Linus. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-04-161-14/+10
|\ \ | |/ | | | | | | | | | | | | | | | | * maint-1.5.4: git-bisect: make "start", "good" and "skip" succeed or fail atomically git-am: cope better with an empty Subject: line Ignore leading empty lines while summarizing merges bisect: squelch "fatal: ref HEAD not a symref" misleading message builtin-apply: Show a more descriptive error on failure when opening a patch Clarify documentation of git-cvsserver, particularly in relation to git-shell
| * git-am: cope better with an empty Subject: lineLinus Torvalds2008-04-161-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the Subject: line is empty for whatever reason, git-am was fooled by it and left an empty line at the beginning of the resulting commit log message. This moves the logic around so that we do not keep $SUBJECT in a separate variable. Instead, $dotest/msg-clean, which used to be the log message body extracted from the message and then trailing whitespaces cleansed out, now contains the subject line followed by a blank line at the beginning for normal messages, and we use the first line from the file as the summary line throughout the program. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remove use of "tail -n 1" and "tail -1"Jeff King2008-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "-n" syntax is not supported by System V versions of tail (which prefer "tail -1"). Unfortunately "tail -1" is not actually POSIX. We had some of both forms in our scripts. Since neither form works everywhere, this patch replaces both with the equivalent sed invocation: sed -ne '$p' Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | am: --rebasingJunio C Hamano2008-03-051-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new option --rebasing is used internally for rebase to tell am that it is being used for its purpose. This would leave .dotest/rebasing to help "completion" scripts tell if the ongoing operation is am or rebase. Also the option at the same time stands for --binary, -3 and -k which are always given when rebase drives am as its backend. Using the information "am" leaves, git-completion.bash tells ongoing rebase and am apart. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | am: remove support for -d .dotestJunio C Hamano2008-03-051-9/+5
| | | | | | | | | | | | | | | | | | It has been supported for a long time, but I do not think this feature has been in use in the real world at all. We would eventually move this out of the toplevel of the work tree and to somewhere under $GIT_DIR, so let's remove the command line option to specify the location now. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | am: read from the right mailbox when started from a subdirectoryJunio C Hamano2008-03-051-2/+23
| | | | | | | | | | | | | | | | | | An earlier commit c149184 (allow git-am to run in a subdirectory) taught git-am to start from a subdirectory by going up to the root of the work tree byitself, but it did not adjust the path to read the mbox from when it did so. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | allow git-am to run in a subdirectoryJeff King2008-03-011-0/+2
|/ | | | | | | | | We just move to the top of the tree and proceed. This shouldn't break any existing callers, since the behavior was previously disallowed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>