git-gui: fix file name handling with non-empty prefix

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.

Acked-by: Andrew Wong <>
Signed-off-by: John Keeping <>
Signed-off-by: Pat Thoyts <>
This commit is contained in:
John Keeping 2013-04-27 14:24:16 +01:00 committed by Pat Thoyts
parent 7d2017e773
commit 2f38dd03fc
1 changed files with 3 additions and 11 deletions

View File

@ -3017,19 +3017,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]
} elseif {[file exists $_prefix$a]} {
if {$path ne {}} usage
set path [normalize_relpath $_prefix$a]
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]
} elseif {$a eq {--}} {
if {$path ne {}} {