summaryrefslogtreecommitdiff
path: root/git-am.sh
AgeCommit message (Collapse)Author
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 <ben@ben.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 <gitster@pobox.com>
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 <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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: git-am.sh
2009-01-28git-am: minor cleanupsJay Soffian
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>
2009-01-26git-am: Add --ignore-date optionNanako Shiraishi
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>
2009-01-26am: Add --committer-date-is-author-date optionJunio C Hamano
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>
2009-01-24git-am: implement --reject option passed to git-applymartin f. krafft
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>
2009-01-22Merge branch 'jf/am-failure-report'Junio C Hamano
* jf/am-failure-report: git-am: re-fix the diag message printing git-am: Make it easier to see which patch failed
2009-01-19git-am: re-fix the diag message printingJunio C Hamano
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>
2009-01-18git-am: Make it easier to see which patch failedJonas Flodén
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>
2009-01-15git-am: fix shell quotingJunio C Hamano
Noticed by Stephan Beyer; the new test is mine. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-12git-am: add --directory=<dir> optionJunio C Hamano
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>
2008-12-06git-am: rename apply_opt_extra file to apply-optJunio C Hamano
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>
2008-12-05git-am: propagate --3way options as wellJunio C Hamano
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>
2008-12-05git-am: propagate -C<n>, -p<n> options as wellJunio C Hamano
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>
2008-12-05git-am --whitespace: do not lose the command line optionJunio C Hamano
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>
2008-08-16git-am: ignore --binary optionStephan Beyer
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>
2008-07-30Replace uses of "git-var" with "git var"Todd Zullinger
Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-26git-am: Mention --abort in usage string part of OPTIONS_SPECStephan Beyer
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>
2008-07-23git-am: Add colon before the subject that is printed out as being appliedStephan Beyer
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>
2008-07-22git am --skip: clean the index while preserving local changesOlivier Marin
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>
2008-07-22git-am: remove dash from help messageOlivier Marin
Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-22Rename .git/rebase to .git/rebase-applyJohannes Schindelin
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>
2008-07-21Merge branch 'ns/am-abort'Junio C Hamano
* ns/am-abort: git am --abort
2008-07-19git am --abortNanako Shiraishi
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>
2008-07-17Merge branch 'sb/dashless'Junio C Hamano
* 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
2008-07-16Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"Johannes Schindelin
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>
2008-07-15Merge branch 'jc/rebase-orig-head'Junio C Hamano
* 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
2008-07-13git-am/git-mailsplit: correct synopsis for reading from stdinStephan Beyer
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>
2008-07-13Make usage strings dash-lessStephan Beyer
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>
2008-07-13git-am: Do not exit silently if committer is unsetStephan Beyer
Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-07Teach "am" and "rebase" to mark the original position with ORIG_HEADJunio C Hamano
"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>
2008-06-17git-am: head -1 is obsolete and doesn't work on some new systemsAlejandro Mery
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>
2008-05-21Merge branch 'maint-1.5.4' into maintJunio C Hamano
* maint-1.5.4: git-am: fix typo in usage message doc/git-daemon: s/uploadarchive/uploadarch/
2008-05-20git-am: fix typo in usage messageJeff King
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-20Merge branch 'jc/maint-rebase-am' into maintJunio C Hamano
* jc/maint-rebase-am: rebase: do not munge commit log message Conflicts: git-am.sh
2008-04-19Merge branch 'maint-1.5.4' into maintJunio C Hamano
* maint-1.5.4: am: POSIX portability fix
2008-04-18am: POSIX portability fixJunio C Hamano
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>
2008-04-17Merge branch 'maint-1.5.4' into maintJunio C Hamano
* maint-1.5.4: git-am: minor cleanup Clarify and fix English in "git-rm" documentation
2008-04-16git-am: minor cleanupJunio C Hamano
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>
2008-04-16rebase: do not munge commit log messageJunio C Hamano
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>
2008-04-16Merge branch 'maint-1.5.4' into maintJunio C Hamano
* 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
2008-04-16git-am: cope better with an empty Subject: lineLinus Torvalds
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>
2008-03-13remove use of "tail -n 1" and "tail -1"Jeff King
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>
2008-03-05am: --rebasingJunio C Hamano
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>
2008-03-05am: remove support for -d .dotestJunio C Hamano
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>
2008-03-05am: read from the right mailbox when started from a subdirectoryJunio C Hamano
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>
2008-03-01allow git-am to run in a subdirectoryJeff King
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>