From: John Keeping <john@keeping.me.uk>
To: Pat Thoyts <patthoyts@users.sourceforge.net>
Cc: git@vger.kernel.org, Andrew Wong <andrew.kw.w@gmail.com>
Subject: Re: [PATCH] git-gui: fix file name handling with non-empty prefix
Date: Sat, 27 Apr 2013 15:18:39 +0100 [thread overview]
Message-ID: <20130427141839.GF472@serenity.lan> (raw)
In-Reply-To: <264998b2b2201b7d6ab9bfa8b5518f712b3a6a08.1367069056.git.john@keeping.me.uk>
I got a bounce with "550 no such user" for Pat's email address when
sending this. Does anyone have more up-to-date contact details? Or is
it just SourceForge being broken?
On Sat, Apr 27, 2013 at 02:24:16PM +0100, John Keeping wrote:
> Commit e3d06ca (git-gui: Detect full path when parsing arguments -
> 2012-10-02) fixed the handling of absolute paths passed to the browser
> and blame subcommands by checking whether the file exists without the
> prefix before prepending the prefix and checking again. Since we have
> chdir'd to the top level of the working tree before doing this, this
> does not work if a file with the same name exists in a subdirectory and
> at the top level (for example Makefile in git.git's t/ directory).
>
> Instead of doing this, revert that patch and fix absolute path issue by
> using "file join" to prepend the prefix to the supplied path. This will
> correctly handle absolute paths by skipping the prefix in that case.
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
> git-gui.sh | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/git-gui.sh b/git-gui.sh
> index e133331..a94ad7f 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -3003,19 +3003,11 @@ blame {
> set jump_spec {}
> set is_path 0
> foreach a $argv {
> - if {[file exists $a]} {
> - if {$path ne {}} usage
> - set path [normalize_relpath $a]
> - break
> - } elseif {[file exists $_prefix$a]} {
> - if {$path ne {}} usage
> - set path [normalize_relpath $_prefix$a]
> - break
> - }
> + set p [file join $_prefix $a]
>
> - if {$is_path} {
> + if {$is_path || [file exists $p]} {
> if {$path ne {}} usage
> - set path [normalize_relpath $_prefix$a]
> + set path [normalize_relpath $p]
> break
> } elseif {$a eq {--}} {
> if {$path ne {}} {
> --
> 1.8.3.rc0.149.g98a72f2.dirty
next prev parent reply other threads:[~2013-04-27 14:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-27 13:24 [PATCH] git-gui: fix file name handling with non-empty prefix John Keeping
2013-04-27 14:18 ` John Keeping [this message]
2013-05-12 2:03 ` Andrew Wong
2013-05-30 15:55 ` John Keeping
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=20130427141839.GF472@serenity.lan \
--to=john@keeping.me.uk \
--cc=andrew.kw.w@gmail.com \
--cc=git@vger.kernel.org \
--cc=patthoyts@users.sourceforge.net \
/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).