Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-checkout: allow pathspec to recover lost working tree directory
author
Junio C Hamano
<junkio@cox.net>
Wed, 15 Nov 2006 18:54:10 +0000
(10:54 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Wed, 15 Nov 2006 20:01:44 +0000
(12:01 -0800)
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>
git-checkout.sh
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
897643c
)
diff --git
a/git-checkout.sh
b/git-checkout.sh
index eb28b291b6d1b7d77306bb3437b9955671e45d3a..737abd0c094ae6cfb201fb46c28f4962a9826a02 100755
(executable)
--- 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