git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2021, 18:38 UTC
Message-ID
<xmqqk0r7rh7l.fsf@gitster.c.googlers.com>
In-Reply-To
<20210214022840.849312-2-seth@eseth.com>
Seth House <seth@eseth.com> writes:
Show 20 quoted lines
> 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.
Show 31 quoted lines
> 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
Previous: Seth HouseNext: David Aguilar
Message 3 of 11 in “mergetools/vimdiff: add vimdiff1 merge tool variant”
  1. 0/1 mergetools/vimdiff: add vimdiff1 merge tool variantSeth House, Feb 14, 2021
  2. 1/1 mergetools/vimdiff: add vimdiff1 merge tool variantSeth House, Feb 14, 2021
  3. Junio C HamanoFeb 16, 2021
  4. David AguilarFeb 23, 2021
  5. Seth HouseFeb 25, 2021
  6. Philippe BlainFeb 25, 2021
  7. Seth HouseFeb 26, 2021
  8. Junio C HamanoFeb 26, 2021
  9. Seth HouseFeb 26, 2021
  10. Junio C HamanoFeb 27, 2021
  11. Seth HouseFeb 27, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.