* [PATCH] git-gui: fix file name handling with non-empty prefix
@ 2013-04-27 13:24 John Keeping
2013-04-27 14:18 ` John Keeping
0 siblings, 1 reply; 4+ messages in thread
From: John Keeping @ 2013-04-27 13:24 UTC (permalink / raw)
To: Pat Thoyts; +Cc: git, Andrew Wong, John Keeping
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] git-gui: fix file name handling with non-empty prefix
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
2013-05-12 2:03 ` Andrew Wong
0 siblings, 1 reply; 4+ messages in thread
From: John Keeping @ 2013-04-27 14:18 UTC (permalink / raw)
To: Pat Thoyts; +Cc: git, Andrew Wong
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] git-gui: fix file name handling with non-empty prefix
2013-04-27 14:18 ` John Keeping
@ 2013-05-12 2:03 ` Andrew Wong
2013-05-30 15:55 ` John Keeping
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Wong @ 2013-05-12 2:03 UTC (permalink / raw)
To: John Keeping; +Cc: Pat Thoyts, git
Sorry for the late reply. I was able to reproduce the problem that you
were describing a while ago. And your patch indeed fixes it. It's a much
more elegant way of dealing with the "absolute vs relative" path problem
that I was trying to fix.
Thanks!
As for Pat, I'm not sure wha'ts going on with his email address. It was
working back in October, and his username still seems to be active over
at SourceForge... let's see if this email reaches him.
Here's a link for his reference just in case he missed your original email:
http://thread.gmane.org/gmane.comp.version-control.git/222646
On 04/27/13 10:18, John Keeping wrote:
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] git-gui: fix file name handling with non-empty prefix
2013-05-12 2:03 ` Andrew Wong
@ 2013-05-30 15:55 ` John Keeping
0 siblings, 0 replies; 4+ messages in thread
From: John Keeping @ 2013-05-30 15:55 UTC (permalink / raw)
To: Pat Thoyts; +Cc: Pat Thoyts, git, Andrew Wong
In the hope that the Pat Thoyts who just posted in another thread from a
GMail address is the same one that maintains git-gui, let's see if that
address works...
On Sat, May 11, 2013 at 10:03:25PM -0400, Andrew Wong wrote:
> Sorry for the late reply. I was able to reproduce the problem that you
> were describing a while ago. And your patch indeed fixes it. It's a much
> more elegant way of dealing with the "absolute vs relative" path problem
> that I was trying to fix.
>
> Thanks!
>
> As for Pat, I'm not sure wha'ts going on with his email address. It was
> working back in October, and his username still seems to be active over
> at SourceForge... let's see if this email reaches him.
>
> Here's a link for his reference just in case he missed your original email:
> http://thread.gmane.org/gmane.comp.version-control.git/222646
>
>
> On 04/27/13 10:18, John Keeping wrote:
> > 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-30 15:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-05-12 2:03 ` Andrew Wong
2013-05-30 15:55 ` John Keeping
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).