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.k...@gmail.com>
---
 git-gui.sh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/git-gui.sh b/git-gui.sh
index 5d035d5..5d7894b 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -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
-- 
1.7.12.1.382.gb0576a6

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to