diff options
-rwxr-xr-x | git-checkout.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/git-checkout.sh b/git-checkout.sh index eb28b291b..737abd0c0 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -112,7 +112,11 @@ Did you intend to checkout '$@' which can not be resolved as commit?" git-ls-tree --full-name -r "$new" "$@" | git-update-index --index-info || exit $? fi - git-checkout-index -f -u -- "$@" + + # Make sure the request is about existing paths. + git-ls-files --error-unmatch -- "$@" >/dev/null || exit + git-ls-files -- "$@" | + git-checkout-index -f -u --stdin exit $? else # Make sure we did not fall back on $arg^{tree} codepath |