git-merge: tighten error checking.

If a branch name to be merged is misspelled, the command leaked error
messages from underlying plumbing commands, which were helpful only
to people who know how the command are implemented to diagnose the
breakage, but simply puzzling and unhelpful for the end users.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-11-26 22:16:31 -08:00
parent 8092c7f6af
commit 51901e96bf

View File

@ -188,13 +188,13 @@ else
# in this loop. # in this loop.
merge_name=$(for remote merge_name=$(for remote
do do
rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) &&
if git show-ref -q --verify "refs/heads/$remote" if git show-ref -q --verify "refs/heads/$remote"
then then
what=branch what=branch
else else
what=commit what=commit
fi fi &&
echo "$rh $what '$remote'" echo "$rh $what '$remote'"
done | git-fmt-merge-msg done | git-fmt-merge-msg
) )
@ -209,7 +209,7 @@ test "$rloga" = '' && rloga="merge: $@"
remoteheads= remoteheads=
for remote for remote
do do
remotehead=$(git-rev-parse --verify "$remote"^0) || remotehead=$(git-rev-parse --verify "$remote"^0 2>/dev/null) ||
die "$remote - not something we can merge" die "$remote - not something we can merge"
remoteheads="${remoteheads}$remotehead " remoteheads="${remoteheads}$remotehead "
done done