Skip to content

Commit

Permalink
git-gui: Detect full path when parsing arguments
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrew Wong authored and Pat Thoyts committed Oct 17, 2012
1 parent 5a5e4d2 commit e3d06ca
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3003,10 +3003,19 @@ blame {
set jump_spec {}
set is_path 0
foreach a $argv {
if {$is_path || [file exists $_prefix$a]} {
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
}
if {$is_path} {
if {$path ne {}} usage
break
} elseif {$a eq {--}} {
if {$path ne {}} {
if {$head ne {}} usage
Expand Down

0 comments on commit e3d06ca

Please sign in to comment.