Re: [PATCH] git-checkout: allow pathspec to recover lost working tree directory
- From
Petr Baudis <pasky@suse.cz>
- Date
- Nov 17, 2006, 15:44 UTC
- Message-ID
- <20061117154459.GF7201@pasky.or.cz>
- In-Reply-To
- <7vbqn8msuw.fsf@assigned-by-dhcp.cox.net>
On Wed, Nov 15, 2006 at 08:07:19PM CET, Junio C Hamano wrote:
Show 17 quoted lines
> diff --git a/git-checkout.sh b/git-checkout.sh
> index eb28b29..737abd0 100755
> --- a/git-checkout.sh
> +++ b/git-checkout.sh
> @@ -112,7 +112,11 @@ Did you intend to checkout '$@' which ca
> 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} codepathWouldn't it be better to fix git-checkout-index to checkout a whole directory if specified?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1