Commit graph

23 commits

Author SHA1 Message Date
Junio C Hamano
8273c79ae2 war on whitespaces: documentation.
We were missing the --whitespace option in the usage string for
git-apply and git-am, so this commit adds them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-02 00:52:59 -08:00
Junio C Hamano
8c31cb822f git-am: --whitespace=x option.
This is passed down to git-apply to override the built-in
default and per-repository configuration at runtime.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-28 22:34:57 -08:00
Junio C Hamano
6d28644d69 git-am: do not allow empty commits by mistake.
Running "git-am --resolved" without doing anything can create an empty
commit. Prevent it.

Thanks for Eric W. Biederman for spotting this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-23 22:14:47 -08:00
Junio C Hamano
d64e6b0429 Keep Porcelainish from failing by broken ident after making changes.
"empty ident not allowed" error makes commit-tree fail, so we
are already safer in that we would not end up with commit
objects that have bogus names on the author or committer fields.
However, before commit-tree is called there are already changes
made to the index file and the working tree.  The operation can
be resumed after fixing the environment problem, but when this
triggers to a newcomer with unusable gecos, the first question
becomes "what did I lose and how would I recover".

This patch modifies some Porcelainish commands to verify
GIT_COMMITTER_IDENT as soon as we know we are going to make some
commits before doing much damage to prevent confusion.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-22 13:14:57 -08:00
Junio C Hamano
1536dd9c61 Only call git-rerere if $GIT_DIR/rr-cache exists.
Johannes noticed that git-rerere depends on Digest.pm, and if
one does not use the command, one can live without it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-11 18:55:43 -08:00
Junio C Hamano
8389b52b2a git-rerere: reuse recorded resolve.
In a workflow that employs relatively long lived topic branches,
the developer sometimes needs to resolve the same conflict over
and over again until the topic branches are done (either merged
to the "release" branch, or sent out and accepted upstream).

This commit introduces a new command, "git rerere", to help this
process by recording the conflicted automerge results and
corresponding hand-resolve results on the initial manual merge,
and later by noticing the same conflicted automerge and applying
the previously recorded hand resolution using three-way merge.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-06 21:53:11 -08:00
Jan Harkes
69224716f7 Fix git-am --skip
git-am --skip does not unpack the next patch and ends up reapplying the
old patch, believing that it is the new patch in the sequence.

If the old patch applied successfully it will commit it with the
supposedly skipped log message and ends up dropping the following patch.
If the patch did not apply the user is left with the conflict he tried
to skip and has to unpack the next patch in the sequence by hand to get
git-am back on track.

By clearing the resume variable whenever skips bumps the sequence
counter we correctly unpack the next patch. I also added another
resume= in the case a patch file is missing from the sequence to
avoid the same problem when a file in the sequence was removed.

Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-16 22:28:19 -08:00
Junio C Hamano
e0e3ba208d mailinfo and git-am: allow "John Doe <johndoe>"
An isolated developer could have a local-only e-mail, which will
be stripped out by mailinfo because it lacks '@'.  Define a
fallback parser to accomodate that.

At the same time, reject authorless patch in git-am.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-14 16:31:06 -08:00
Junio C Hamano
9a26dbd120 Merge branch 'hold/am' 2005-12-14 13:04:43 -08:00
freku045@student.liu.se
cf1fe88ce1 git-am: Usage string clean-up
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-14 02:53:44 -08:00
H. Peter Anvin
b3f041fb0f git-am support for naked email messages (take 2)
This allows git-am to accept single-message files as well as mboxes.
Unlike the previous version, this one doesn't need to be explicitly told
which one it is; rather, it looks to see if the first line is a From
line and uses it to select mbox mode or not.

I moved the logic to do all this into git-mailsplit, which got a new
user interface as result, although the old interface is still available
for backwards compatibility.

[jc: applied with two obvious fixes.]

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-14 02:04:56 -08:00
Jason Riedy
9754563ca9 Use printf rather than echo -n.
On AIX, there is no -n option to the system's echo.  Instead,
it needs the '\c' control character.  We could replace
  echo -n "foo"
with
  echo -e "foo\c"
but printf is recommended by most man pages.  Tested on AIX
5.3, Solaris 8, and Debian.

[jc: futureproofed two instances that uses variable with '%s'
 so later feeding different messages would not break things too
 easily; others are emitting literal so whoever changes the
 literal ought to notice more easily so they are safe.]

Signed-off-by: E. Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-06 18:09:12 -08:00
Junio C Hamano
ae2b0f1518 git-sh-setup: die if outside git repository.
Now all the users of this script detect its exit status and die,
complaining that it is outside git repository.  So move the code
that dies from all callers to git-sh-setup script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:49:17 -08:00
Junio C Hamano
087b6742fc git-am: --binary; document --resume and --binary.
Now git-apply can grok binary replacement patches, give --binary
flag to git-am.  As a safety measure, this is not by default
enabled, so that you do not let malicious e-mailed patch to
replace an arbitrary path with just a couple of lines (diff
index lines, the filename and string "Binary files "...) by
accident.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-17 22:36:31 -08:00
Junio C Hamano
0c15cc921a git-am: --resolved.
After failed patch application, you can manually apply the patch
(this includes resolving the conflicted merge after git-am falls
back to 3-way merge) and run git-update-index on necessary paths
to prepare the index file in a shape a successful patch
application should have produced.  Then re-running git-am --resolved
would record the resulting index file along with the commit log
information taken from the patch e-mail.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-16 16:19:11 -08:00
Junio C Hamano
4bfb6b62ff git-am: do not lose already edited final-commit when resuming.
The last round stopped munging the patch when resuming, but
failed to preserve final-commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-08 01:23:53 -08:00
Junio C Hamano
f89ad67fb0 Add [v]iew patch in git-am interactive.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-25 23:43:59 -07:00
Junio C Hamano
271440e3b6 git-am: make it easier after fixing up an unapplicable patch.
Instead of having the user to edit the mail message, let the hand merge
result stored in .dotest/patch and continue, which is easier to manage.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-25 23:35:37 -07:00
Junio C Hamano
2c674191d5 Fix missing exports in git-am
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-20 22:31:56 -07:00
Junio C Hamano
22943f1a52 Update git-apply to use C-style quoting for funny pathnames.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-17 17:41:54 -07:00
Junio C Hamano
73319032c8 git-am: do not fail if 3-way fallback succeeds.
The current one incorrectly stops there without committing.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-13 11:46:43 -07:00
Junio C Hamano
a1451104ac git-am: interactive should fail gracefully.
When feeding patches from standard input, and --interactive is specified,
quit, so that the user can re-run the command, instead of infinitely
looping.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-12 18:31:41 -07:00
Junio C Hamano
d1c5f2a42d Add git-am, applymbox replacement.
It reorganizes the code and also has saner command line options
syntax.  Unlike git-applymbox, it can take more than one mailbox
file from the command line, as well as reading from the standard
input when '-' is specified.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-07 03:44:18 -07:00