Subject: [PATCH 4/6] Add DirDiffTool as additional option

From: Pierre Dumuid <[email-masked]>
Date: Thu, 15 Dec 2016 21:58:45 +1030

Signed-off-by: Pierre Dumuid <[email-masked]>
---
 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