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 <andrew.kw.w@gmail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Andrew Wong committed
Oct 2, 2012 at 12:25 UTC
e3d06ca93eebaf5e4bf8438255a30fb6c91ab277
1 file changed
+10
-1
git-gui.sh
+10
-1
@@ -3003,10 +3003,19 @@ blame {
3003
set jump_spec {}
3004
set is_path 0
3005
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]} {
3011
if {$path ne {}} usage
3012
set path [normalize_relpath $_prefix$a]
3013
break
3014
+ }
3015
+
3016
+ if {$is_path} {
3017
+ if {$path ne {}} usage
3018
+ break
3019
} elseif {$a eq {--}} {
3020
if {$path ne {}} {
3021
if {$head ne {}} usage