summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorLibravatar Alexander Gavrilov <angavrilov@gmail.com>2008-08-23 12:32:20 +0400
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2008-08-24 22:00:01 -0700
commitf7078b40917daa20ea3fa54c7e38766594e4b996 (patch)
treeb7f04ebe76a01e353a753e767f0b625430fcfd60 /git-gui.sh
parentgit-gui: Better positioning in Blame Parent Commit (diff)
downloadtgif-f7078b40917daa20ea3fa54c7e38766594e4b996.tar.xz
git-gui: Allow specifying an initial line for git gui blame.
Add a command-line option to make git gui blame automatically scroll to a specific line in the file. Useful for integration with other tools. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/git-gui.sh b/git-gui.sh
index b0207ac36a..ec08b5a921 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2296,10 +2296,15 @@ proc usage {} {
switch -- $subcommand {
browser -
blame {
- set subcommand_args {rev? path}
+ if {$subcommand eq "blame"} {
+ set subcommand_args {[--line=<num>] rev? path}
+ } else {
+ set subcommand_args {rev? path}
+ }
if {$argv eq {}} usage
set head {}
set path {}
+ set jump_spec {}
set is_path 0
foreach a $argv {
if {$is_path || [file exists $_prefix$a]} {
@@ -2313,6 +2318,9 @@ blame {
set path {}
}
set is_path 1
+ } elseif {[regexp {^--line=(\d+)$} $a a lnum]} {
+ if {$jump_spec ne {} || $head ne {}} usage
+ set jump_spec [list $lnum]
} elseif {$head eq {}} {
if {$head ne {}} usage
set head $a
@@ -2344,6 +2352,7 @@ blame {
switch -- $subcommand {
browser {
+ if {$jump_spec ne {}} usage
if {$head eq {}} {
if {$path ne {} && [file isdirectory $path]} {
set head $current_branch
@@ -2359,7 +2368,7 @@ blame {
puts stderr [mc "fatal: cannot stat path %s: No such file or directory" $path]
exit 1
}
- blame::new $head $path
+ blame::new $head $path $jump_spec
}
}
return