aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-11-15 10:54:10 -0800
committerJunio C Hamano <junkio@cox.net>2006-11-15 12:01:44 -0800
commitbf7e1472df65c948581e2fecd494eccfaa40b9d9 (patch)
treef3cdde9ca4a5a0c4f30c6b0fc6ef6542f3349723
parent897643cc79cb8c05694c98a4fb0560c78952db3e (diff)
downloadgit-bf7e1472df65c948581e2fecd494eccfaa40b9d9.tar.gz
git-bf7e1472df65c948581e2fecd494eccfaa40b9d9.tar.xz
git-checkout: allow pathspec to recover lost working tree directory
It is often wanted on the #git channel that this were to work to recover removed directory: rm -fr Documentation git checkout -- Documentation git checkout HEAD -- Documentation ;# alternatively Now it does. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xgit-checkout.sh6
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