summaryrefslogtreecommitdiff
path: root/git-checkout.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-11 14:12:08 -0700
committerJunio C Hamano <junkio@cox.net>2005-09-12 19:15:03 -0700
commit7f88c8463caa14ca397048f8e576e348ce73203a (patch)
treee0bd6601780818570eb85ef8235b19c40b3c160b /git-checkout.sh
parent4a5b63e3e966184aa1ff32770410d485202562ca (diff)
downloadgit-7f88c8463caa14ca397048f8e576e348ce73203a.tar.gz
[PATCH] Make 'git checkout' a bit more forgiving when switching branches.
If you make a commit on a path, and then make the path cache-dirty afterwards without changing its contents, 'git checkout' to switch to another branch is prevented because switching the branches done with 'read-tree -m -u $current $next' detects that the path is cache-dirty, but it does not bother noticing that the contents of the path has not been actualy changed. Since switching branches would involve checking out paths different in the two branches, hence it is reasonably expensive operation, we can afford to run update-index before running read-tree to reduce this kind of false change from triggering the check needlessly. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-checkout.sh')
-rwxr-xr-xgit-checkout.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-checkout.sh b/git-checkout.sh
index 4e7c57a5f3..4a605cd9c6 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -55,6 +55,7 @@ then
git-read-tree --reset $new &&
git-checkout-index -q -f -u -a
else
+ git-update-index --refresh >/dev/null
git-read-tree -m -u $old $new
fi