git-checkout -m: fix merge case

Commit c1a4278e switched the "merging checkout" implementation
from 3-way read-tree to merge-recursive, but forgot that
merge-recursive will signal an unmerged state with its own exit
status code.  This prevented the clean-up phase (paths cleanly
merged should not be updated in the index) from running.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano
2007-01-23 16:51:22 -08:00
parent c9a8992569
commit d7ebd53d37
2 changed files with 32 additions and 11 deletions

View File

@ -200,17 +200,12 @@ else
# Match the index to the working tree, and do a three-way.
git diff-files --name-only | git update-index --remove --stdin &&
work=`git write-tree` &&
git read-tree --reset -u $new &&
eval GITHEAD_$new=${new_name:-${branch:-$new}} GITHEAD_$work=local &&
export GITHEAD_$new GITHEAD_$work &&
git merge-recursive $old -- $new $work || exit
git read-tree --reset -u $new || exit
if result=`git write-tree 2>/dev/null`
then
echo >&2 "Trivially automerged."
else
git merge-index -o git-merge-one-file -a
fi
eval GITHEAD_$new=${new_name:-${branch:-$new}} &&
eval GITHEAD_$work=local &&
export GITHEAD_$new GITHEAD_$work &&
git merge-recursive $old -- $new $work
# Do not register the cleanly merged paths in the index yet.
# this is not a real merge before committing, but just carrying