Skip to content

Commit e3d06ca

Browse files
andrewkwwpatthoyts
authored andcommitted
git-gui: Detect full path when parsing arguments
When running "git-gui blame" from a subfolder (which means prefix is non-empty), if we pass a full path as argument, the argument parsing will fail to recognize the argument as a file name, because prefix is prepended to the argument. This patch handles that scenario by adding an additional branch that checks the file name without using the prefix. Signed-off-by: Andrew Wong <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent 5a5e4d2 commit e3d06ca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

git-gui.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3003,10 +3003,19 @@ blame {
30033003
set jump_spec {}
30043004
set is_path 0
30053005
foreach a $argv {
3006-
if {$is_path || [file exists $_prefix$a]} {
3006+
if {[file exists $a]} {
3007+
if {$path ne {}} usage
3008+
set path [normalize_relpath $a]
3009+
break
3010+
} elseif {[file exists $_prefix$a]} {
30073011
if {$path ne {}} usage
30083012
set path [normalize_relpath $_prefix$a]
30093013
break
3014+
}
3015+
3016+
if {$is_path} {
3017+
if {$path ne {}} usage
3018+
break
30103019
} elseif {$a eq {--}} {
30113020
if {$path ne {}} {
30123021
if {$head ne {}} usage

0 commit comments

Comments
 (0)