summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b276ee)
raw | patch | inline | side by side (parent: 5b276ee)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 20 Jun 2006 09:47:14 +0000 (02:47 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 21 Jun 2006 05:21:11 +0000 (22:21 -0700) |
Earlier we did not consider untracked working tree files
"precious", but we have always considered them fair game to
clobber. These days, branch switching by read-tree is more
careful and tries to protect untracked working tree files. This
caused the following workflow to stop working:
git checkout one-branch-with-file-F
git checkout -f another-without-file-F
git pull . one-branch-with-file-F
Because the second checkout leaves F from the previous state as
untracked file in the working tree, the merge would fail, trying
to protect F from being clobbered.
This changes "git checkout -f" to remove working tree files that
are known to git in the switched-from state but do not exist in
the switched-to state, borrowing the same logic from "reset --hard".
Signed-off-by: Junio C Hamano <junkio@cox.net>
"precious", but we have always considered them fair game to
clobber. These days, branch switching by read-tree is more
careful and tries to protect untracked working tree files. This
caused the following workflow to stop working:
git checkout one-branch-with-file-F
git checkout -f another-without-file-F
git pull . one-branch-with-file-F
Because the second checkout leaves F from the previous state as
untracked file in the working tree, the merge would fail, trying
to protect F from being clobbered.
This changes "git checkout -f" to remove working tree files that
are known to git in the switched-from state but do not exist in
the switched-to state, borrowing the same logic from "reset --hard".
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-checkout.sh | patch | blob | history |
diff --git a/git-checkout.sh b/git-checkout.sh
index 564117f0064aba32e190a49106eaecfdb422b31e..77c25938091b75f51eb3cc5922d67db6333e1e74 100755 (executable)
--- a/git-checkout.sh
+++ b/git-checkout.sh
if [ "$force" ]
then
- git-read-tree --reset $new &&
- git-checkout-index -q -f -u -a
+ git-read-tree --reset -u $new
else
git-update-index --refresh >/dev/null
merge_error=$(git-read-tree -m -u $old $new 2>&1) || (