Signed-off-by: Pierre Dumuid <pmdum...@gmail.com>
---
 gitk | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gitk b/gitk
index a894f1d..5f27716 100755
--- a/gitk
+++ b/gitk
@@ -2661,6 +2661,9 @@ proc makewindow {} {
        {mc "Diff this -> marked commit" command {diffvsmark 0}}
        {mc "Diff marked commit -> this" command {diffvsmark 1}}
        {mc "Revert this commit" command revert}
+
+       {mc "DirDiffTool this -> selected" command {externalDiffToolVsSel 0}}
+       {mc "DirDiffTool selected -> this" command {externalDiffToolVsSel 1}}
     }
     $rowctxmenu configure -tearoff 0
 
@@ -9254,6 +9257,20 @@ proc diffvssel {dirn} {
     doseldiff $oldid $newid
 }
 
+proc externalDiffToolVsSel {diffDirection} {
+    global rowmenuid selectedline
+
+    if {$selectedline eq {}} return
+    if {$diffDirection} {
+       set oldid [commitonrow $selectedline]
+       set newid $rowmenuid
+    } else {
+       set oldid $rowmenuid
+       set newid [commitonrow $selectedline]
+    }
+    [exec git difftool -d $oldid $newid]
+}
+
 proc diffvsmark {dirn} {
     global rowmenuid markedid
 
-- 
2.10.2

Reply via email to