@matheusbsbs / matheus-bagliano / commits / d1014a1745
Fork 0

fail pull/merge early in the middle of conflicted merge

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>

Junio C Hamano committed Dec 31, 2006 at 23:21 UTC d1014a1745a8aa90c8de2a5ac7624d8175f96724
2 files changed +6
git-merge.sh
+3
@@ -8,6 +8,9 @@ USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commi
8 . git-sh-setup
9 set_reflog_action "merge $*"
10
11 +test -z "$(git ls-files -u)" ||
12 + die "You are in a middle of conflicted merge."
13 +
14 LF='
15 '
16
git-pull.sh
+3
@@ -9,6 +9,9 @@ LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEA
9 . git-sh-setup
10 set_reflog_action "pull $*"
11
12 +test -z "$(git ls-files -u)" ||
13 + die "You are in a middle of conflicted merge."
14 +
15 strategy_args= no_summary= no_commit= squash=
16 while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac
17 do