git-gui: Don't prepend the prefix if value looks like a full path
authorAndrew Wong <andrew.kw.w@gmail.com>
Tue, 2 Oct 2012 16:25:15 +0000 (12:25 -0400)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Wed, 17 Oct 2012 20:47:50 +0000 (21:47 +0100)
When argument parsing fails to detect a file name, "git-gui" will try to
use the previously detected "head" as the file name. We should avoid
prepending the prefix if "head" looks like a full path.

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
git-gui.sh

index 5d7894bd940f1de7ed6c8d823416cb5ac1d76a8a..89f636f4963cf7933639f6a23b3be2e8fd4c0964 100755 (executable)
@@ -3037,8 +3037,13 @@ blame {
        unset is_path
 
        if {$head ne {} && $path eq {}} {
-               set path [normalize_relpath $_prefix$head]
-               set head {}
+               if {[string index $head 0] eq {/}} {
+                       set path [normalize_relpath $head]
+                       set head {}
+               } else {
+                       set path [normalize_relpath $_prefix$head]
+                       set head {}
+               }
        }
 
        if {$head eq {}} {