git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junio@pobox.com>
To: David Symonds <dsymonds@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] git-checkout: Handle relative paths containing "..".
Date: Thu, 08 Nov 2007 00:30:20 -0800	[thread overview]
Message-ID: <7v4pfx3zs3.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1194489192-20021-1-git-send-email-dsymonds@gmail.com> (David Symonds's message of "Thu, 8 Nov 2007 13:33:12 +1100")

David Symonds <dsymonds@gmail.com> writes:

> diff --git a/git-checkout.sh b/git-checkout.sh
> index 8993920..b2c50aa 100755
> --- a/git-checkout.sh
> +++ b/git-checkout.sh
> @@ -134,9 +134,10 @@ 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 "$(git-rev-parse --show-cdup)" &&
> +		 git checkout-index -f -u --stdin)

Have you tested this patch from the toplevel of any tree, where
"git-rev-parse --show-cdup" would yield an empty string?

I also wonder how this patch (with an obvious fix to address the
above point) would interact with GIT_DIR and/or GIT_WORK_TREE in
the environment.

  reply	other threads:[~2007-11-08  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-08  2:33 [PATCH] git-checkout: Handle relative paths containing ".." David Symonds
2007-11-08  8:30 ` Junio C Hamano [this message]
2007-11-08 13:10   ` David Symonds
2007-11-08 14:25     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v4pfx3zs3.fsf@gitster.siamese.dyndns.org \
    --to=junio@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dsymonds@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).