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>
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 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>
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>
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>
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>
* 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
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>
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>
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>
"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>
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>
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>
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>
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>
* 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
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>
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>
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>
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>
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>
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>
With "too many unreachable loose objects" git gc --auto will always
trigger. This clutters the output of git am and thus git rebase.
Signed-off-by: Michael Stefaniuc <mstefani@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
git-am -i: report rewritten title
git grep shows the same hit repeatedly for unmerged paths
Do check_repository_format() early (re-fix)
Do check_repository_format() early
Add missing inside_work_tree setting in setup_git_directory_gently
Jeff Garzik noticed that "git am -i" reports the applied patch with
the title before the user edited it. This was confusing.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This reverts commit 6e9e0327b7. People
can prepare a text file with Subject: and From: headers and feed it to
"am" (pretending the file is a piece of e-mail), and have actually been
doing so. Strict checking for Date: breaks this established workflow,
which wants to record the time of the commit as the author time.
Thanks go to Jens Axboe for injection of sanity.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Even though commit-tree would default to the current time if the incoming
e-mail message somehow did not record the timestamp, it is safer to catch
the breakage sooner.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When you have a file called HEAD in your work tree, many commands that
our scripts feed "HEAD" to would complain about the rev vs path
ambiguity. A solution is to form command line more carefully by
appending -- to them, which makes it clear that we mean HEAD rev not
HEAD file.
This patch would apply to maint.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
$ git am -3 -s -i file
spewed the usage strings back at the user while
$ git am -3 -i -s file
didn't. This fixes it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This was lost in the migration to git-rev-parse --parseopt by commit
78443d9049.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jc/autogc:
git-gc --auto: run "repack -A -d -l" as necessary.
git-gc --auto: restructure the way "repack" command line is built.
git-gc --auto: protect ourselves from accumulated cruft
git-gc --auto: add documentation.
git-gc --auto: move threshold check to need_to_gc() function.
repack -A -d: use --keep-unreachable when repacking
pack-objects --keep-unreachable
Export matches_pack_name() and fix its return value
Invoke "git gc --auto" from commit, merge, am and rebase.
Implement git gc --auto
We used to say "Applying <patch subject>", "Wrote <tree
object>", and "Committed <commit object>". Worse yet, with
extra blank lines around them.
Make the output more concise. The object names are not so
useful nor interesting.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-am used "git apply -z --index-info" to find the original versions
of the files touched by the diff, to be able to do an inexpensive
three-way merge.
This operation makes only sense in a repository, since the index
information in the diff refers to blobs, which have to be present in
the current repository.
Therefore, teach "git apply" a mode to write out the result as an
index file to begin with, obviating the need for scripts to do it
themselves.
The sole user for --index-info is "git am" is converted to
use --build-fake-ancestor in this patch.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
A lot of shell scripts contained stuff starting with
while case "$#" in 0) break ;; esac
and similar. I consider breaking out of the condition instead of the
body od the loop ugly, and the implied "true" value of the
non-matching case is not really obvious to humans at first glance. It
happens not to be obvious to some BSD shells, either, but that's
because they are not POSIX-compliant. In most cases, this has been
replaced by a straight condition using "test". "case" has the
advantage of being faster than "test" on vintage shells where "test"
is not a builtin. Since none of them is likely to run the git
scripts, anyway, the added readability should be worth the change.
A few loops have had their termination condition expressed
differently.
Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>