git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Seth House <seth@eseth.com>
To: git@vger.kernel.org
Cc: Seth House <seth@eseth.com>
Subject: [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant
Date: Sat, 13 Feb 2021 19:28:40 -0700	[thread overview]
Message-ID: <20210214022840.849312-2-seth@eseth.com> (raw)
In-Reply-To: <20210214022840.849312-1-seth@eseth.com>

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 <seth@eseth.com>
---
 mergetools/vimdiff | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

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
-- 
2.29.2



  reply	other threads:[~2021-02-14  2:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-14  2:28 [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant Seth House
2021-02-14  2:28 ` Seth House [this message]
2021-02-16 18:38   ` [PATCH 1/1] " Junio C Hamano
2021-02-23 18:55     ` David Aguilar
2021-02-25 16:02       ` Seth House
2021-02-25 18:45 ` [PATCH 0/1] " Philippe Blain
2021-02-26  0:29   ` Seth House
2021-02-26  2:04     ` Junio C Hamano
2021-02-26 23:35       ` Seth House
2021-02-27  1:52         ` Junio C Hamano
2021-02-27  2:17           ` Seth House

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210214022840.849312-2-seth@eseth.com \
    --to=seth@eseth.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).