about summary refs log tree commit diff
path: root/mergetools
diff options
context:
space:
mode:
Diffstat (limited to 'mergetools')
-rw-r--r--mergetools/araxis18
-rw-r--r--mergetools/bc23
-rw-r--r--mergetools/bc31
-rw-r--r--mergetools/codecompare23
-rw-r--r--mergetools/deltawalker25
-rw-r--r--mergetools/diffmerge18
-rw-r--r--mergetools/diffuse15
-rw-r--r--mergetools/ecmerge14
-rw-r--r--mergetools/emerge26
-rw-r--r--mergetools/examdiff16
-rw-r--r--mergetools/guiffy18
-rw-r--r--mergetools/gvimdiff1
-rw-r--r--mergetools/gvimdiff21
-rw-r--r--mergetools/gvimdiff31
-rw-r--r--mergetools/kdiff327
-rw-r--r--mergetools/kompare11
-rw-r--r--mergetools/meld36
-rw-r--r--mergetools/opendiff14
-rw-r--r--mergetools/p4merge36
-rw-r--r--mergetools/smerge12
-rw-r--r--mergetools/tkdiff16
-rw-r--r--mergetools/tortoisemerge32
-rw-r--r--mergetools/vimdiff48
-rw-r--r--mergetools/vimdiff21
-rw-r--r--mergetools/vimdiff31
-rw-r--r--mergetools/winmerge15
-rw-r--r--mergetools/xxdiff23
27 files changed, 472 insertions, 0 deletions
diff --git a/mergetools/araxis b/mergetools/araxis
new file mode 100644
index 000000000000..e2407b65b70d
--- /dev/null
+++ b/mergetools/araxis
@@ -0,0 +1,18 @@
+diff_cmd () {
+	"$merge_tool_path" -wait -2 "$LOCAL" "$REMOTE" >/dev/null 2>&1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" -wait -merge -3 -a1 \
+			"$BASE" "$LOCAL" "$REMOTE" "$MERGED" >/dev/null 2>&1
+	else
+		"$merge_tool_path" -wait -2 \
+			"$LOCAL" "$REMOTE" "$MERGED" >/dev/null 2>&1
+	fi
+}
+
+translate_merge_tool_path() {
+	echo compare
+}
diff --git a/mergetools/bc b/mergetools/bc
new file mode 100644
index 000000000000..3a69e60faa9c
--- /dev/null
+++ b/mergetools/bc
@@ -0,0 +1,23 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" "$LOCAL" "$REMOTE" "$BASE" \
+			-mergeoutput="$MERGED"
+	else
+		"$merge_tool_path" "$LOCAL" "$REMOTE" \
+			-mergeoutput="$MERGED"
+	fi
+}
+
+translate_merge_tool_path() {
+	if type bcomp >/dev/null 2>/dev/null
+	then
+		echo bcomp
+	else
+		echo bcompare
+	fi
+}
diff --git a/mergetools/bc3 b/mergetools/bc3
new file mode 100644
index 000000000000..5d8dd4818488
--- /dev/null
+++ b/mergetools/bc3
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/bc"
diff --git a/mergetools/codecompare b/mergetools/codecompare
new file mode 100644
index 000000000000..9f60e8da6527
--- /dev/null
+++ b/mergetools/codecompare
@@ -0,0 +1,23 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" -MF="$LOCAL" -TF="$REMOTE" -BF="$BASE" \
+			-RF="$MERGED"
+	else
+		"$merge_tool_path" -MF="$LOCAL" -TF="$REMOTE" \
+			-RF="$MERGED"
+	fi
+}
+
+translate_merge_tool_path() {
+	if merge_mode
+	then
+		echo CodeMerge
+	else
+		echo CodeCompare
+	fi
+}
diff --git a/mergetools/deltawalker b/mergetools/deltawalker
new file mode 100644
index 000000000000..ee6f374bceb8
--- /dev/null
+++ b/mergetools/deltawalker
@@ -0,0 +1,25 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE" >/dev/null 2>&1
+}
+
+merge_cmd () {
+	# Adding $(pwd)/ in front of $MERGED should not be necessary.
+	# However without it, DeltaWalker (at least v1.9.8 on Windows)
+	# crashes with a JRE exception.  The DeltaWalker user manual,
+	# shows $(pwd)/ whenever the '-merged' options is given.
+	# Adding it here seems to work around the problem.
+	if $base_present
+	then
+		"$merge_tool_path" "$LOCAL" "$REMOTE" "$BASE" -merged="$(pwd)/$MERGED"
+	else
+		"$merge_tool_path" "$LOCAL" "$REMOTE" -merged="$(pwd)/$MERGED"
+	fi >/dev/null 2>&1
+}
+
+translate_merge_tool_path () {
+	echo DeltaWalker
+}
+
+exit_code_trustable () {
+	true
+}
diff --git a/mergetools/diffmerge b/mergetools/diffmerge
new file mode 100644
index 000000000000..9b6355b98a71
--- /dev/null
+++ b/mergetools/diffmerge
@@ -0,0 +1,18 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE" >/dev/null 2>&1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" --merge --result="$MERGED" \
+			"$LOCAL" "$BASE" "$REMOTE"
+	else
+		"$merge_tool_path" --merge \
+			--result="$MERGED" "$LOCAL" "$REMOTE"
+	fi
+}
+
+exit_code_trustable () {
+	true
+}
diff --git a/mergetools/diffuse b/mergetools/diffuse
new file mode 100644
index 000000000000..5a3ae8b5695d
--- /dev/null
+++ b/mergetools/diffuse
@@ -0,0 +1,15 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE" | cat
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" \
+			"$LOCAL" "$MERGED" "$REMOTE" \
+			"$BASE" | cat
+	else
+		"$merge_tool_path" \
+			"$LOCAL" "$MERGED" "$REMOTE" | cat
+	fi
+}
diff --git a/mergetools/ecmerge b/mergetools/ecmerge
new file mode 100644
index 000000000000..6c5101c4f729
--- /dev/null
+++ b/mergetools/ecmerge
@@ -0,0 +1,14 @@
+diff_cmd () {
+	"$merge_tool_path" --default --mode=diff2 "$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" \
+			--default --mode=merge3 --to="$MERGED"
+	else
+		"$merge_tool_path" "$LOCAL" "$REMOTE" \
+			--default --mode=merge2 --to="$MERGED"
+	fi
+}
diff --git a/mergetools/emerge b/mergetools/emerge
new file mode 100644
index 000000000000..d1ce513ff5d3
--- /dev/null
+++ b/mergetools/emerge
@@ -0,0 +1,26 @@
+diff_cmd () {
+	"$merge_tool_path" -f emerge-files-command "$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" \
+			-f emerge-files-with-ancestor-command \
+			"$LOCAL" "$REMOTE" "$BASE" \
+			"$(basename "$MERGED")"
+	else
+		"$merge_tool_path" \
+			-f emerge-files-command \
+			"$LOCAL" "$REMOTE" \
+			"$(basename "$MERGED")"
+	fi
+}
+
+translate_merge_tool_path() {
+	echo emacs
+}
+
+exit_code_trustable () {
+	true
+}
diff --git a/mergetools/examdiff b/mergetools/examdiff
new file mode 100644
index 000000000000..e72b06fc4d8f
--- /dev/null
+++ b/mergetools/examdiff
@@ -0,0 +1,16 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE" -nh
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" -merge "$LOCAL" "$BASE" "$REMOTE" -o:"$MERGED" -nh
+	else
+		"$merge_tool_path" -merge "$LOCAL" "$REMOTE" -o:"$MERGED" -nh
+	fi
+}
+
+translate_merge_tool_path() {
+	mergetool_find_win32_cmd "ExamDiff.com" "ExamDiff Pro"
+}
diff --git a/mergetools/guiffy b/mergetools/guiffy
new file mode 100644
index 000000000000..8b23a13c4111
--- /dev/null
+++ b/mergetools/guiffy
@@ -0,0 +1,18 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" -s "$LOCAL" \
+		"$REMOTE" "$BASE" "$MERGED"
+	else
+		"$merge_tool_path" -m "$LOCAL" \
+		"$REMOTE" "$MERGED"
+	fi
+}
+
+exit_code_trustable () {
+	true
+}
diff --git a/mergetools/gvimdiff b/mergetools/gvimdiff
new file mode 100644
index 000000000000..04a5bb0ea848
--- /dev/null
+++ b/mergetools/gvimdiff
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/vimdiff"
diff --git a/mergetools/gvimdiff2 b/mergetools/gvimdiff2
new file mode 100644
index 000000000000..04a5bb0ea848
--- /dev/null
+++ b/mergetools/gvimdiff2
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/vimdiff"
diff --git a/mergetools/gvimdiff3 b/mergetools/gvimdiff3
new file mode 100644
index 000000000000..04a5bb0ea848
--- /dev/null
+++ b/mergetools/gvimdiff3
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/vimdiff"
diff --git a/mergetools/kdiff3 b/mergetools/kdiff3
new file mode 100644
index 000000000000..0264ed5b20b2
--- /dev/null
+++ b/mergetools/kdiff3
@@ -0,0 +1,27 @@
+diff_cmd () {
+	"$merge_tool_path" \
+		--L1 "$MERGED (A)" --L2 "$MERGED (B)" \
+		"$LOCAL" "$REMOTE" >/dev/null 2>&1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" --auto \
+			--L1 "$MERGED (Base)" \
+			--L2 "$MERGED (Local)" \
+			--L3 "$MERGED (Remote)" \
+			-o "$MERGED" "$BASE" "$LOCAL" "$REMOTE" \
+		>/dev/null 2>&1
+	else
+		"$merge_tool_path" --auto \
+			--L1 "$MERGED (Local)" \
+			--L2 "$MERGED (Remote)" \
+			-o "$MERGED" "$LOCAL" "$REMOTE" \
+		>/dev/null 2>&1
+	fi
+}
+
+exit_code_trustable () {
+	true
+}
diff --git a/mergetools/kompare b/mergetools/kompare
new file mode 100644
index 000000000000..e8c0bfa67854
--- /dev/null
+++ b/mergetools/kompare
@@ -0,0 +1,11 @@
+can_merge () {
+	return 1
+}
+
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE"
+}
+
+exit_code_trustable () {
+	true
+}
diff --git a/mergetools/meld b/mergetools/meld
new file mode 100644
index 000000000000..7a08470f8836
--- /dev/null
+++ b/mergetools/meld
@@ -0,0 +1,36 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	if test -z "${meld_has_output_option:+set}"
+	then
+		check_meld_for_output_version
+	fi
+
+	if test "$meld_has_output_option" = true
+	then
+		"$merge_tool_path" --output="$MERGED" \
+			"$LOCAL" "$BASE" "$REMOTE"
+	else
+		"$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
+	fi
+}
+
+# Check whether we should use 'meld --output <file>'
+check_meld_for_output_version () {
+	meld_path="$(git config mergetool.meld.path)"
+	meld_path="${meld_path:-meld}"
+
+	if meld_has_output_option=$(git config --bool mergetool.meld.hasOutput)
+	then
+		: use configured value
+	elif "$meld_path" --help 2>&1 |
+		grep -e '--output=' -e '\[OPTION\.\.\.\]' >/dev/null
+	then
+		: old ones mention --output and new ones just say OPTION...
+		meld_has_output_option=true
+	else
+		meld_has_output_option=false
+	fi
+}
diff --git a/mergetools/opendiff b/mergetools/opendiff
new file mode 100644
index 000000000000..b608dd6de30a
--- /dev/null
+++ b/mergetools/opendiff
@@ -0,0 +1,14 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE" | cat
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" "$LOCAL" "$REMOTE" \
+			-ancestor "$BASE" -merge "$MERGED" | cat
+	else
+		"$merge_tool_path" "$LOCAL" "$REMOTE" \
+			-merge "$MERGED" | cat
+	fi
+}
diff --git a/mergetools/p4merge b/mergetools/p4merge
new file mode 100644
index 000000000000..7a5b291dd28a
--- /dev/null
+++ b/mergetools/p4merge
@@ -0,0 +1,36 @@
+diff_cmd () {
+	empty_file=
+
+	# p4merge does not like /dev/null
+	if test "/dev/null" = "$LOCAL"
+	then
+		LOCAL="$(create_empty_file)"
+	fi
+	if test "/dev/null" = "$REMOTE"
+	then
+		REMOTE="$(create_empty_file)"
+	fi
+
+	"$merge_tool_path" "$LOCAL" "$REMOTE"
+
+	if test -n "$empty_file"
+	then
+		rm -f "$empty_file"
+	fi
+}
+
+merge_cmd () {
+	if ! $base_present
+	then
+		cp -- "$LOCAL" "$BASE"
+		create_virtual_base "$BASE" "$REMOTE"
+	fi
+	"$merge_tool_path" "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
+}
+
+create_empty_file () {
+	empty_file="${TMPDIR:-/tmp}/git-difftool-p4merge-empty-file.$$"
+	>"$empty_file"
+
+	printf "%s" "$empty_file"
+}
diff --git a/mergetools/smerge b/mergetools/smerge
new file mode 100644
index 000000000000..9c2e6f6fd7d0
--- /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
+}
diff --git a/mergetools/tkdiff b/mergetools/tkdiff
new file mode 100644
index 000000000000..eee5cb57e3cc
--- /dev/null
+++ b/mergetools/tkdiff
@@ -0,0 +1,16 @@
+diff_cmd () {
+	"$merge_tool_path" "$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" -a "$BASE" -o "$MERGED" "$LOCAL" "$REMOTE"
+	else
+		"$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"
+	fi
+}
+
+exit_code_trustable () {
+	true
+}
diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
new file mode 100644
index 000000000000..d7ab666a59a2
--- /dev/null
+++ b/mergetools/tortoisemerge
@@ -0,0 +1,32 @@
+can_diff () {
+	return 1
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		basename="$(basename "$merge_tool_path" .exe)"
+		if test "$basename" = "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"
+		fi
+	else
+		echo "$merge_tool_path cannot be used without a base" 1>&2
+		return 1
+	fi
+}
+
+translate_merge_tool_path() {
+	if type tortoisegitmerge >/dev/null 2>/dev/null
+	then
+		echo tortoisegitmerge
+	else
+		echo tortoisemerge
+	fi
+}
diff --git a/mergetools/vimdiff b/mergetools/vimdiff
new file mode 100644
index 000000000000..10d86f3e1930
--- /dev/null
+++ b/mergetools/vimdiff
@@ -0,0 +1,48 @@
+diff_cmd () {
+	"$merge_tool_path" -R -f -d \
+		-c 'wincmd l' -c 'cd $GIT_PREFIX' "$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	case "$1" in
+	gvimdiff|vimdiff)
+		if $base_present
+		then
+			"$merge_tool_path" -f -d -c '4wincmd w | wincmd J' \
+				"$LOCAL" "$BASE" "$REMOTE" "$MERGED"
+		else
+			"$merge_tool_path" -f -d -c 'wincmd l' \
+				"$LOCAL" "$MERGED" "$REMOTE"
+		fi
+		;;
+	gvimdiff2|vimdiff2)
+		"$merge_tool_path" -f -d -c 'wincmd l' \
+			"$LOCAL" "$MERGED" "$REMOTE"
+		;;
+	gvimdiff3|vimdiff3)
+		if $base_present
+		then
+			"$merge_tool_path" -f -d -c 'hid | hid | hid' \
+				"$LOCAL" "$REMOTE" "$BASE" "$MERGED"
+		else
+			"$merge_tool_path" -f -d -c 'hid | hid' \
+				"$LOCAL" "$REMOTE" "$MERGED"
+		fi
+		;;
+	esac
+}
+
+translate_merge_tool_path() {
+	case "$1" in
+	gvimdiff|gvimdiff2|gvimdiff3)
+		echo gvim
+		;;
+	vimdiff|vimdiff2|vimdiff3)
+		echo vim
+		;;
+	esac
+}
+
+exit_code_trustable () {
+	true
+}
diff --git a/mergetools/vimdiff2 b/mergetools/vimdiff2
new file mode 100644
index 000000000000..04a5bb0ea848
--- /dev/null
+++ b/mergetools/vimdiff2
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/vimdiff"
diff --git a/mergetools/vimdiff3 b/mergetools/vimdiff3
new file mode 100644
index 000000000000..04a5bb0ea848
--- /dev/null
+++ b/mergetools/vimdiff3
@@ -0,0 +1 @@
+. "$MERGE_TOOLS_DIR/vimdiff"
diff --git a/mergetools/winmerge b/mergetools/winmerge
new file mode 100644
index 000000000000..74d03259fdf1
--- /dev/null
+++ b/mergetools/winmerge
@@ -0,0 +1,15 @@
+diff_cmd () {
+	"$merge_tool_path" -u -e "$LOCAL" "$REMOTE"
+	return 0
+}
+
+merge_cmd () {
+	# mergetool.winmerge.trustExitCode is implicitly false.
+	# touch $BACKUP so that we can check_unchanged.
+	"$merge_tool_path" -u -e -dl Local -dr Remote \
+		"$LOCAL" "$REMOTE" "$MERGED"
+}
+
+translate_merge_tool_path() {
+	mergetool_find_win32_cmd "WinMergeU.exe" "WinMerge"
+}
diff --git a/mergetools/xxdiff b/mergetools/xxdiff
new file mode 100644
index 000000000000..ce5b8e9f2962
--- /dev/null
+++ b/mergetools/xxdiff
@@ -0,0 +1,23 @@
+diff_cmd () {
+	"$merge_tool_path" \
+		-R 'Accel.Search: "Ctrl+F"' \
+		-R 'Accel.SearchForward: "Ctrl+G"' \
+		"$LOCAL" "$REMOTE"
+}
+
+merge_cmd () {
+	if $base_present
+	then
+		"$merge_tool_path" -X --show-merged-pane \
+			-R 'Accel.SaveAsMerged: "Ctrl+S"' \
+			-R 'Accel.Search: "Ctrl+F"' \
+			-R 'Accel.SearchForward: "Ctrl+G"' \
+			--merged-file "$MERGED" "$LOCAL" "$BASE" "$REMOTE"
+	else
+		"$merge_tool_path" -X $extra \
+			-R 'Accel.SaveAsMerged: "Ctrl+S"' \
+			-R 'Accel.Search: "Ctrl+F"' \
+			-R 'Accel.SearchForward: "Ctrl+G"' \
+			--merged-file "$MERGED" "$LOCAL" "$REMOTE"
+	fi
+}