X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-checkout.sh;h=616d1eb8f8647d69bca0decc181aff2657bfae73;hb=fed1b5cac0cc3ae324dc004181a276ea16589951;hp=17f43927aa7b766c1ba28150c4945fac7ff3e132;hpb=5071877d2c623ffc41b48bbb49908a61051a6228;p=git.git diff --git a/git-checkout.sh b/git-checkout.sh index 17f43927a..616d1eb8f 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -134,9 +134,16 @@ Did you intend to checkout '$@' which can not be resolved as commit?" fi # 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 + git ls-files --full-name --error-unmatch -- "$@" >/dev/null || exit + git ls-files --full-name -- "$@" | + (cd_to_toplevel && git checkout-index -f -u --stdin) + + # Run a post-checkout hook -- the HEAD does not change so the + # current HEAD is passed in for both args + if test -x "$GIT_DIR"/hooks/post-checkout; then + "$GIT_DIR"/hooks/post-checkout $old $old 0 + fi + exit $? else # Make sure we did not fall back on $arg^{tree} codepath @@ -284,3 +291,8 @@ if [ "$?" -eq 0 ]; then else exit 1 fi + +# Run a post-checkout hook +if test -x "$GIT_DIR"/hooks/post-checkout; then + "$GIT_DIR"/hooks/post-checkout $old $new 1 +fi