Subject: [PATCH 1/2] mergetools: add support for smerge (Sublime Merge)

From: David Aguilar <[email-masked]>
Date: Thu, 4 Apr 2019 00:34:38 -0700

Teach difftool and mergetool about the Sublime Merge "smerge" command.

Signed-off-by: David Aguilar <[email-masked]>
---
 git-mergetool--lib.sh |  1 +
 mergetools/smerge     | 12 ++++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 mergetools/smerge

diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 83bf52494c..aaa4eed0bc 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -279,6 +279,7 @@ list_merge_tool_candidates () {
 		fi
 		tools="$tools gvimdiff diffuse diffmerge ecmerge"
 		tools="$tools p4merge araxis bc codecompare"
+		tools="$tools smerge"
 	fi
 	case "${VISUAL:-$EDITOR}" in
 	*vim*)
diff --git a/mergetools/smerge b/mergetools/smerge
new file mode 100644
index 0000000000..9c2e6f6fd7
--- /dev/null
+++ b/mergetools/smerge
@@ -0,0 +1,12 @@
+diff_cmd () {
+	"$merge_tool_path" mergetool "$LOCAL" "$REMOTE" -o "$MERGED"
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"
+	else
+		"$merge_tool_path" mergetool "$LOCAL" "$REMOTE" -o "$MERGED"
+	fi
+}
-- 
2.21.0.198.gfad8868f4e