]> git.ipfire.org Git - thirdparty/git.git/commitdiff
gitk: Switch to patch mode when searching for line origin
authorMax Kirillov <max@max630.net>
Sat, 5 Apr 2014 20:38:50 +0000 (23:38 +0300)
committerPaul Mackerras <paulus@samba.org>
Sun, 15 Jun 2014 01:35:50 +0000 (11:35 +1000)
If the "Show origin of this line" is started from tree mode,
it still shows the result in tree mode, which I suppose not
what user expects to see.

Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk

diff --git a/gitk b/gitk
index 2f58bcfbdda4deccec8d1750f38fff2c27ab109a..a4a8bd30ae17e5f5de77d5ed044822f0bccf2eaa 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -3871,7 +3871,7 @@ proc read_line_source {fd inst} {
            set id $nullid2
        }
        if {[commitinview $id $curview]} {
-           selectline [rowofcommit $id] 1 [list $fname $lnum]
+           selectline [rowofcommit $id] 1 [list $fname $lnum] 1
        } else {
            error_popup [mc "That line comes from commit %s, \
                             which is not in this view" [shortids $id]]
@@ -7162,7 +7162,7 @@ proc make_idmark {id} {
     $canv raise $t
 }
 
-proc selectline {l isnew {desired_loc {}}} {
+proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
     global canv ctext commitinfo selectedline
     global canvy0 linespc parents children curview
     global currentid sha1entry
@@ -7188,6 +7188,10 @@ proc selectline {l isnew {desired_loc {}}} {
        setcanvscroll
     }
 
+    if {$cmitmode ne "patch" && $switch_to_patch} {
+        set cmitmode "patch"
+    }
+
     set y [expr {$canvy0 + $l * $linespc}]
     set ymax [lindex [$canv cget -scrollregion] 3]
     set ytop [expr {$y - $linespc - 1}]