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 (2 12:25 -0400)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Wed, 17 Oct 2012 20:47:50 +0000 (17 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 5d7894b..89f636f 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 {}} {