git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant
@ 2021-02-14  2:28 Seth House
  2021-02-14  2:28 ` [PATCH 1/1] " Seth House
  2021-02-25 18:45 ` [PATCH 0/1] " Philippe Blain
  0 siblings, 2 replies; 11+ messages in thread
From: Seth House @ 2021-02-14  2:28 UTC (permalink / raw)
  To: git; +Cc: Seth House, pudinha, David Aguilar, Junio C Hamano

Add yet another vimdiff layout variant to present the simplest possible
two-way diff when resolving conflicts.

The name is an attempt at UNIX-style humor -- vimdiff3 opens four
buffers and vimdiff2 opens three buffers so vimdiff1 should therefore
open two buffers. It also communicates that vimdiff will be used and
fits cleanly into the existing layout variant naming. That said,
suggestions welcome if that isn't as great a fit as I think it is. :)

Seth House (1):
  mergetools/vimdiff: add vimdiff1 merge tool variant

 mergetools/vimdiff | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

-- 
2.29.2



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-14  2:28 [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant Seth House
@ 2021-02-14  2:28 ` Seth House
  2021-02-16 18:38   ` Junio C Hamano
  2021-02-25 18:45 ` [PATCH 0/1] " Philippe Blain
  1 sibling, 1 reply; 11+ messages in thread
From: Seth House @ 2021-02-14  2:28 UTC (permalink / raw)
  To: git; +Cc: Seth House

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



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-14  2:28 ` [PATCH 1/1] " Seth House
@ 2021-02-16 18:38   ` Junio C Hamano
  2021-02-23 18:55     ` David Aguilar
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2021-02-16 18:38 UTC (permalink / raw)
  To: git; +Cc: Seth House

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

Any vimdiff$n + "git mergetool" users care to comment?  Thanks.

> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-16 18:38   ` Junio C Hamano
@ 2021-02-23 18:55     ` David Aguilar
  2021-02-25 16:02       ` Seth House
  0 siblings, 1 reply; 11+ messages in thread
From: David Aguilar @ 2021-02-23 18:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List, Seth House

On Tue, Feb 16, 2021 at 10:42 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> Seth House <seth@eseth.com> 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 <seth@eseth.com>
> > ---
> >  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 <davvid@gmail.com>

cheers,

--
David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-23 18:55     ` David Aguilar
@ 2021-02-25 16:02       ` Seth House
  0 siblings, 0 replies; 11+ messages in thread
From: Seth House @ 2021-02-25 16:02 UTC (permalink / raw)
  To: David Aguilar; +Cc: Junio C Hamano, Git Mailing List

On Tue, Feb 23, 2021 at 10:55:00AM -0800, David Aguilar wrote:
> Looks good to me.  FWIW,
> Tested-by: David Aguilar <davvid@gmail.com>

Thank you for testing that, David.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-14  2:28 [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant Seth House
  2021-02-14  2:28 ` [PATCH 1/1] " Seth House
@ 2021-02-25 18:45 ` Philippe Blain
  2021-02-26  0:29   ` Seth House
  1 sibling, 1 reply; 11+ messages in thread
From: Philippe Blain @ 2021-02-25 18:45 UTC (permalink / raw)
  To: Seth House, git; +Cc: pudinha, David Aguilar, Junio C Hamano

Hi Seth,

Le 2021-02-13 à 21:28, Seth House a écrit :
> Add yet another vimdiff layout variant to present the simplest possible
> two-way diff when resolving conflicts.
> 
> The name is an attempt at UNIX-style humor -- vimdiff3 opens four
> buffers and vimdiff2 opens three buffers so vimdiff1 should therefore
> open two buffers. It also communicates that vimdiff will be used and
> fits cleanly into the existing layout variant naming. That said,
> suggestions welcome if that isn't as great a fit as I think it is. :)

I like the name :P Slightly orthogonal though, when I first looked
at the output of 'git mergetool --tool-help', I was sort of confused by
vimdiff2 and vimdiff3 (and some others) because I looked for them in PATH and (of course)
could not find them, still Git was telling me they were available.

I think it would be good to add a short note about these variants somewhere
in Documentation/git-mergetool.txt. Might be in this patch, or not if you don't
feel like it...

Going further, we could even add a short (few words) description of each tool
and have that description show up in the output of  'git mergetool --tool-help',
something like this:

$ git mergetool --tool-help
'git mergetool --tool=<tool>' may be set to one of the following:
		emerge		Emacs (Emerge)
		opendiff	Apple FileMerge
		vimdiff		Vim (??)
		vimdiff2	Vim (3 panes)
		vimdiff3	Vim (4 panes)

Cheers,

Philippe.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Seth House @ 2021-02-26  0:29 UTC (permalink / raw)
  To: Philippe Blain; +Cc: git, pudinha, David Aguilar, Junio C Hamano

On Thu, Feb 25, 2021 at 01:45:16PM -0500, Philippe Blain wrote:
> I think it would be good to add a short note about these variants somewhere
> in Documentation/git-mergetool.txt. Might be in this patch, or not if you don't
> feel like it...
> 
> Going further, we could even add a short (few words) description of each tool
> and have that description show up in the output of  'git mergetool --tool-help',
> something like this:
> 
> $ git mergetool --tool-help
> 'git mergetool --tool=<tool>' may be set to one of the following:
> 		emerge		Emacs (Emerge)
> 		opendiff	Apple FileMerge
> 		vimdiff		Vim (??)
> 		vimdiff2	Vim (3 panes)
> 		vimdiff3	Vim (4 panes)

Great suggestions, thanks. A little explanation would be very helpful --
I've been confused by those variants too and wondered why I might want
to use one over another.

I'll roll those into this patch.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-26  0:29   ` Seth House
@ 2021-02-26  2:04     ` Junio C Hamano
  2021-02-26 23:35       ` Seth House
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2021-02-26  2:04 UTC (permalink / raw)
  To: Seth House; +Cc: Philippe Blain, git, pudinha, David Aguilar

Seth House <seth@eseth.com> writes:

> On Thu, Feb 25, 2021 at 01:45:16PM -0500, Philippe Blain wrote:
>> I think it would be good to add a short note about these variants somewhere
>> in Documentation/git-mergetool.txt. Might be in this patch, or not if you don't
>> feel like it...
>> 
>> Going further, we could even add a short (few words) description of each tool
>> and have that description show up in the output of  'git mergetool --tool-help',
>> something like this:
>> 
>> $ git mergetool --tool-help
>> 'git mergetool --tool=<tool>' may be set to one of the following:
>> 		emerge		Emacs (Emerge)
>> 		opendiff	Apple FileMerge
>> 		vimdiff		Vim (??)
>> 		vimdiff2	Vim (3 panes)
>> 		vimdiff3	Vim (4 panes)
>
> Great suggestions, thanks. A little explanation would be very helpful --
> I've been confused by those variants too and wondered why I might want
> to use one over another.
>
> I'll roll those into this patch.

I'd rather see it as a completely separate patch.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-26  2:04     ` Junio C Hamano
@ 2021-02-26 23:35       ` Seth House
  2021-02-27  1:52         ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Seth House @ 2021-02-26 23:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Philippe Blain, git, pudinha, David Aguilar

On Thu, Feb 25, 2021 at 06:04:53PM -0800, Junio C Hamano wrote:
> Seth House <seth@eseth.com> writes:
> > I'll roll those into this patch.
> 
> I'd rather see it as a completely separate patch.

Ok, will do.

Should I roll a v2 of this patch set to include David's tested-by tag
even though there's no code changes?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-26 23:35       ` Seth House
@ 2021-02-27  1:52         ` Junio C Hamano
  2021-02-27  2:17           ` Seth House
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2021-02-27  1:52 UTC (permalink / raw)
  To: Seth House; +Cc: Philippe Blain, git, pudinha, David Aguilar

Seth House <seth@eseth.com> writes:

> On Thu, Feb 25, 2021 at 06:04:53PM -0800, Junio C Hamano wrote:
>> Seth House <seth@eseth.com> writes:
>> > I'll roll those into this patch.
>> 
>> I'd rather see it as a completely separate patch.
>
> Ok, will do.
>
> Should I roll a v2 of this patch set to include David's tested-by tag
> even though there's no code changes?

I think that is exactly what we have on sh/mergetools-vimdiff1 topic
branch in 'next'.

    $ git fetch
    $ git show 'origin/next^{/^mergetools/vimdiff:}'

Thanks.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant
  2021-02-27  1:52         ` Junio C Hamano
@ 2021-02-27  2:17           ` Seth House
  0 siblings, 0 replies; 11+ messages in thread
From: Seth House @ 2021-02-27  2:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Philippe Blain, git, pudinha, David Aguilar

On Fri, Feb 26, 2021 at 05:52:22PM -0800, Junio C Hamano wrote:
> I think that is exactly what we have on sh/mergetools-vimdiff1 topic
> branch in 'next'.

Oh, whoops. Thanks! I'll get into the habit of watching 'next' more
closely.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-27  2:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14  2:28 [PATCH 0/1] mergetools/vimdiff: add vimdiff1 merge tool variant Seth House
2021-02-14  2:28 ` [PATCH 1/1] " Seth House
2021-02-16 18:38   ` 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

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).