Skip to content

Commit

Permalink
[PATCH] Make 'git checkout' a bit more forgiving when switching branc…
Browse files Browse the repository at this point in the history
…hes.

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>
  • Loading branch information
Junio C Hamano committed Sep 13, 2005
1 parent 4a5b63e commit 7f88c84
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions git-checkout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7f88c84

Please sign in to comment.