summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Andrew Wong <andrew.kw.w@gmail.com>2012-10-02 12:25:14 -0400
committerLibravatar Pat Thoyts <patthoyts@users.sourceforge.net>2012-10-17 21:47:49 +0100
commite3d06ca93eebaf5e4bf8438255a30fb6c91ab277 (patch)
treea6453cc148eba8d565e3c6cb4f4e32e449902800
parentgit-gui: remove .git/CHERRY_PICK_HEAD after committing (diff)
downloadtgif-e3d06ca93eebaf5e4bf8438255a30fb6c91ab277.tar.xz
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>
-rwxr-xr-xgit-gui.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 5d035d5a17..5d7894bd94 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