]> asedeno.scripts.mit.edu Git - git.git/commitdiff
fail pull/merge early in the middle of conflicted merge
authorJunio C Hamano <junkio@cox.net>
Mon, 1 Jan 2007 07:21:50 +0000 (23:21 -0800)
committerJunio C Hamano <junkio@cox.net>
Mon, 1 Jan 2007 22:35:16 +0000 (14:35 -0800)
After a pull that results in a conflicted merge, a new user
often tries another "git pull" in desperation.  When the index
is unmerged, merge backends correctly bail out without touching
either index nor the working tree, so this does not make the
wound any worse.

The user will however see several lines of messsages during this
process, such as "filename: needs merge", "you need to resolve
your current index first", "Merging...", and "Entry ... would be
overwritten by merge. Cannot merge.".  They are unnecessarily
alarming, and cause useful conflict messages from the first pull
scroll off the top of the terminal.

This changes pull and merge to run "git-ls-files -u" upfront and
stop them much earlier than we currently do.  Old timers may
know better and would not to try pulling again before cleaning
things up; this change adds extra overhead that is unnecessary
for them.  But this would be worth paying for to save new people
from needless confusion.

Signed-off-by: Junio C Hamano <junkio@cox.net>
git-merge.sh
git-pull.sh

index ba42260426296b63070a1fbdc22a9b77ea5ac412..477002910ede7f6bc6bcb9a79f6ddebd248f6bd2 100755 (executable)
@@ -8,6 +8,9 @@ USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commi
 . git-sh-setup
 set_reflog_action "merge $*"
 
+test -z "$(git ls-files -u)" ||
+       die "You are in a middle of conflicted merge."
+
 LF='
 '
 
index 28d08195f0c84b7f3a89a5c5cff9945bb64ddfb3..c184fb81a4dab622d79120bcc986c3bf2b07df7f 100755 (executable)
@@ -9,6 +9,9 @@ LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEA
 . git-sh-setup
 set_reflog_action "pull $*"
 
+test -z "$(git ls-files -u)" ||
+       die "You are in a middle of conflicted merge."
+
 strategy_args= no_summary= no_commit= squash=
 while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac
 do