Re: [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant

3 messages, 3 authors, 2021-02-25 · open the first message on its own page

Re: [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant

From: Junio C Hamano <hidden>
Date: 2021-02-16 18:39:15

Seth House [off-list ref] writes:
This adds yet another vimdiff/gvimdiff variant and presents conflicts as
a two-way diff between 'LOCAL' and 'REMOTE'. 'MERGED' is not opened
which deviates from the norm so usage text is echoed as a Vim message on
startup that instructs the user with how to proceed and how to abort.

Vimdiff is well-suited to two-way diffs so this is an option for a more
simple, more streamlined conflict resolution. For example: it is
difficult to communicate differences across more than two files using
only syntax highlighting; default vimdiff commands to get and put
changes between buffers do not need the user to manually specify
a source or destination buffer when only using two buffers.

Like other merge tools that directly compare 'LOCAL' with 'REMOTE', this
tool will benefit when paired with the new `mergetool.hideResolved`
setting.

Signed-off-by: Seth House <redacted>
---
 mergetools/vimdiff | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
Any vimdiff$n + "git mergetool" users care to comment?  Thanks.
quoted hunk
diff --git a/mergetools/vimdiff b/mergetools/vimdiff
index abc8ce4ec4..96f6209a04 100644
--- a/mergetools/vimdiff
+++ b/mergetools/vimdiff
@@ -15,6 +15,17 @@ merge_cmd () {
 				"$LOCAL" "$MERGED" "$REMOTE"
 		fi
 		;;
+	*vimdiff1)
+		"$merge_tool_path" -f -d \
+			-c 'echon "Resolve conflicts leftward then save. Use :cq to abort."' \
+			"$LOCAL" "$REMOTE"
+		ret="$?"
+		if test "$ret" -eq 0
+		then
+			cp -- "$LOCAL" "$MERGED"
+		fi
+		return "$ret"
+		;;
 	*vimdiff2)
 		"$merge_tool_path" -f -d -c 'wincmd l' \
 			"$LOCAL" "$MERGED" "$REMOTE"
@@ -52,7 +63,7 @@ exit_code_trustable () {
 
 list_tool_variants () {
 	for prefix in '' g n; do
-		for suffix in '' 2 3; do
+		for suffix in '' 1 2 3; do
 			echo "${prefix}vimdiff${suffix}"
 		done
 	done

Re: [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant

From: David Aguilar <hidden>
Date: 2021-02-23 18:56:29

On Tue, Feb 16, 2021 at 10:42 AM Junio C Hamano [off-list ref] wrote:
Seth House [off-list ref] writes:
quoted
This adds yet another vimdiff/gvimdiff variant and presents conflicts as
a two-way diff between 'LOCAL' and 'REMOTE'. 'MERGED' is not opened
which deviates from the norm so usage text is echoed as a Vim message on
startup that instructs the user with how to proceed and how to abort.

Vimdiff is well-suited to two-way diffs so this is an option for a more
simple, more streamlined conflict resolution. For example: it is
difficult to communicate differences across more than two files using
only syntax highlighting; default vimdiff commands to get and put
changes between buffers do not need the user to manually specify
a source or destination buffer when only using two buffers.

Like other merge tools that directly compare 'LOCAL' with 'REMOTE', this
tool will benefit when paired with the new `mergetool.hideResolved`
setting.

Signed-off-by: Seth House <redacted>
---
 mergetools/vimdiff | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
Any vimdiff$n + "git mergetool" users care to comment?  Thanks.
Nicely done, thanks Seth.

Looks good to me.  FWIW,
Tested-by: David Aguilar <redacted>

cheers,

--
David

Re: [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant

From: Seth House <hidden>
Date: 2021-02-25 16:15:04

On Tue, Feb 23, 2021 at 10:55:00AM -0800, David Aguilar wrote:
Looks good to me.  FWIW,
Tested-by: David Aguilar <redacted>
Thank you for testing that, David.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help