Use merge-recursive in git-checkout -m (branch switching)

This allows "git checkout -m <other-branch>" to notice renames and
carry local changes in the working tree forward.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano
2007-01-16 20:46:39 -08:00
parent 7905ba626e
commit c1a4278ee3
2 changed files with 36 additions and 10 deletions

View File

@ -201,8 +201,9 @@ else
git diff-files --name-only | git update-index --remove --stdin &&
work=`git write-tree` &&
git read-tree --reset -u $new &&
git read-tree -m -u --aggressive --exclude-per-directory=.gitignore $old $new $work ||
exit
eval GITHEAD_$new=${new_name:-${branch:-$new}} GITHEAD_$work=local &&
export GITHEAD_$new GITHEAD_$work &&
git merge-recursive $old -- $new $work || exit
if result=`git write-tree 2>/dev/null`
then