Thread (15 messages) flat view 15 messages, 3 authors, 2018-05-09

Re: [PATCH 2/2] gitk: add an option to run gitk on an item in the file list

From: Bert Wesarg <hidden>
Date: 2018-05-08 13:17:07

On Tue, May 8, 2018 at 2:22 PM, Alex Riesen
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Alex Riesen <redacted>

Similar to a git gui feature which visualizes history in a submodule,
the submodules cause the gitk be started inside the submodule.

Signed-off-by: Alex Riesen <redacted>
---
 gitk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/gitk b/gitk
index d34833f..1ec545e 100755
--- a/gitk
+++ b/gitk
@@ -2682,6 +2682,7 @@ proc makewindow {} {
        {mc "External diff" command {external_diff}}
        {mc "Blame parent commit" command {external_blame 1}}
        {mc "Copy path" command {clipboard clear; clipboard append $flist_menu_file}}
+       {mc "Run gitk on this" command {flist_gitk}}
     }
     $flist_menu configure -tearoff 0
@@ -3555,6 +3556,17 @@ proc flist_hl {only} {
     set gdttype [mc "touching paths:"]
 }

+proc flist_gitk {} {
+    global flist_menu_file findstring gdttype
+
+    set x [shellquote $flist_menu_file]
this needs to handle cdup, i.e., if gitk is run from a subdirectory,
all paths needs to be prefixed with $cdup, like: [file join $cdup
$flist_menu_file]

Bert
+    if {[file isdirectory $flist_menu_file]} {
+       exec sh -c "cd $x&&gitk" &
+    } else {
+       exec gitk -- $x &
+    }
+}
+
 proc gitknewtmpdir {} {
     global diffnum gitktmpdir gitdir env
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help