<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-mergetool--lib.sh, branch v2.34.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.34.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.34.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-02-18T01:21:41Z</updated>
<entry>
<title>Merge branch 'sh/mergetool-hideresolved'</title>
<updated>2021-02-18T01:21:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-02-18T01:21:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=78a26cb7204ddb96a5f75f09e41fbefd81c85f59'/>
<id>urn:sha1:78a26cb7204ddb96a5f75f09e41fbefd81c85f59</id>
<content type='text'>
"git mergetool" feeds three versions (base, local and remote) of
a conflicted path unmodified.  The command learned to optionally
prepare these files with unconflicted parts already resolved.

* sh/mergetool-hideresolved:
  mergetool: add per-tool support and overrides for the hideResolved flag
  mergetool: break setup_tool out into separate initialization function
  mergetool: add hideResolved configuration
</content>
</entry>
<entry>
<title>mergetool: add per-tool support and overrides for the hideResolved flag</title>
<updated>2021-02-09T22:09:16Z</updated>
<author>
<name>Seth House</name>
<email>seth@eseth.com</email>
</author>
<published>2021-02-09T20:07:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9d9cf230317f7fe7cb153f61b537e6e9bef22e3b'/>
<id>urn:sha1:9d9cf230317f7fe7cb153f61b537e6e9bef22e3b</id>
<content type='text'>
Add a per-tool override flag so that users may enable the flag for one
tool and disable it for another by setting
`mergetool.&lt;tool&gt;.hideResolved` to `false`.

In addition, the author or maintainer of a mergetool may optionally
override the default `hideResolved` value for that mergetool. If the
`mergetools/&lt;tool&gt;` shell script contains a `hide_resolved_enabled`
function it will be called when the mergetool is invoked and the return
value will be used as the default for the `hideResolved` flag.

    hide_resolved_enabled () {
        return 1
    }

Disabling may be desirable if the mergetool wants or needs access to the
original, unmodified 'LOCAL' and 'REMOTE' versions of the conflicted
file. For example:

- A tool may use a custom conflict resolution algorithm and prefer to
  ignore the results of Git's conflict resolution.
- A tool may want to visually compare/constrast the version of the file
  from before the merge (saved to 'LOCAL', 'REMOTE', and 'BASE') with
  Git's conflict resolution results (saved to 'MERGED').

Helped-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Seth House &lt;seth@eseth.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mergetool: break setup_tool out into separate initialization function</title>
<updated>2021-02-09T22:09:16Z</updated>
<author>
<name>Seth House</name>
<email>seth@eseth.com</email>
</author>
<published>2021-02-09T20:07:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=de8dafbada811bc1bc8e1288541931f3c5406231'/>
<id>urn:sha1:de8dafbada811bc1bc8e1288541931f3c5406231</id>
<content type='text'>
This is preparation for the following commit where we need to source the
mergetool shell script to look for overrides before `run_merge_tool` is
called. Previously `run_merge_tool` both sourced that script and invoked
the mergetool.

In the case of the following commit, we need the result of the
`hide_resolved` override, if present, before we actually run
`run_merge_tool`.

The new `initialize_merge_tool` wrapper is exposed and documented as
a public interface for consistency with the existing `run_merge_tool`
which is also public. Although `setup_tool` could instead be exposed
directly, the related `setup_user_tool` would probably also want to be
elevated to match and this felt the cleanest to me.

Signed-off-by: Seth House &lt;seth@eseth.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pb/mergetool-tool-help-fix'</title>
<updated>2021-01-16T05:48:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-01-16T05:48:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=073552d7ae5f34b93f9540787874c1ea0fff8051'/>
<id>urn:sha1:073552d7ae5f34b93f9540787874c1ea0fff8051</id>
<content type='text'>
Fix 2.29 regression where "git mergetool --tool-help" fails to list
all the available tools.

* pb/mergetool-tool-help-fix:
  mergetool--lib: fix '--tool-help' to correctly show available tools
</content>
</entry>
<entry>
<title>mergetool--lib: fix '--tool-help' to correctly show available tools</title>
<updated>2021-01-07T02:31:27Z</updated>
<author>
<name>Philippe Blain</name>
<email>levraiphilippeblain@gmail.com</email>
</author>
<published>2021-01-07T01:09:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=80f5a16798b7ff224aeab4a6b6e3627446071345'/>
<id>urn:sha1:80f5a16798b7ff224aeab4a6b6e3627446071345</id>
<content type='text'>
Commit 83bbf9b92e (mergetool--lib: improve support for vimdiff-style tool
variants, 2020-07-29) introduced a regression in the output of `git mergetool
--tool-help` and `git difftool --tool-help` [1].

In function 'show_tool_names' in git-mergetool--lib.sh, we loop over the
supported mergetools and their variants and accumulate them in the variable
'variants', separating them with a literal '\n'.

The code then uses 'echo $variants' to turn these '\n' into newlines, but this
behaviour is not portable, it just happens to work in some shells, like
dash(1)'s 'echo' builtin.

For shells in which 'echo' does not turn '\n' into newlines, the end
result is that the only tools that are shown are the existing variants
(except the last variant alphabetically), since the variants are
separated by actual newlines in '$variants' because of the several
'echo' calls in mergetools/{bc,vimdiff}::list_tool_variants.

Fix this bug by embedding an actual line feed into `variants` in
show_tool_names(). While at it, replace `sort | uniq` by `sort -u`.

To prevent future regressions, add a simple test that checks that a few
known tools are correctly shown (let's avoid counting the total number
of tools to lessen the maintenance burden when new tools are added or if
'--tool-help' learns additional logic, like hiding tools depending on
the current platform).

[1] https://lore.kernel.org/git/CADtb9DyozjgAsdFYL8fFBEWmq7iz4=prZYVUdH9W-J5CKVS4OA@mail.gmail.com/

Reported-by: Philippe Blain &lt;levraiphilippeblain@gmail.com&gt;
Based-on-patch-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Philippe Blain &lt;levraiphilippeblain@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mergetool: avoid letting `list_tool_variants` break user-defined setups</title>
<updated>2020-11-11T21:00:11Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-11-11T20:33:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=12026f46e73ba09b8c403079bccc72a3b85e8dc9'/>
<id>urn:sha1:12026f46e73ba09b8c403079bccc72a3b85e8dc9</id>
<content type='text'>
In 83bbf9b92ea8 (mergetool--lib: improve support for vimdiff-style tool
variants, 2020-07-29), we introduced a `list_tool_variants` function
in the spirit of Postel's Law: be lenient in what you accept as input.
In this particular instance, we wanted to allow not only `bc` but also
`bc3` as name for the Beyond Compare tool.

However, what this patch overlooked is that it is totally allowed for
users to override the defaults in `mergetools/`. But now that we strip
off trailing digits, the name that the user gave the tool might not
actually be in the list produced by `list_tool_variants`.

So let's do the same as for the `diff_cmd` and the `merge_cmd`: override
it with the trivial version in case a user-defined setup was detected.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mergetools: add support for nvimdiff (neovim) family</title>
<updated>2020-07-29T21:44:49Z</updated>
<author>
<name>pudinha</name>
<email>rogi@skylittlesystem.org</email>
</author>
<published>2020-07-29T21:31:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=11868978c7c80d3c29071b29e7964e3d62523819'/>
<id>urn:sha1:11868978c7c80d3c29071b29e7964e3d62523819</id>
<content type='text'>
Signed-off-by: pudinha &lt;rogi@skylittlesystem.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mergetool--lib: improve support for vimdiff-style tool variants</title>
<updated>2020-07-29T21:44:46Z</updated>
<author>
<name>pudinha</name>
<email>rogi@skylittlesystem.org</email>
</author>
<published>2020-07-29T21:31:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=83bbf9b92ea8a10a60f44369a200b39ce5db78cd'/>
<id>urn:sha1:83bbf9b92ea8a10a60f44369a200b39ce5db78cd</id>
<content type='text'>
The merge tools vimdiff2, vimdiff3, gvimdiff2, gvimdiff3 and bc3 are all
variants of the main tools vimdiff and bc. They are implemented in the
main and a one-liner script that just sources it exist for each.

Allow variants ending in [0-9] to be correctly wired without the need
for such one-liners, so instead of 5 scripts, only 1 (gvimdiff) is
needed.

Signed-off-by: pudinha &lt;rogi@skylittlesystem.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'dl/difftool-mergetool'</title>
<updated>2019-05-19T07:45:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-05-19T07:45:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=85ac27e04fd0cf1d086028e87f69ffb498c1451b'/>
<id>urn:sha1:85ac27e04fd0cf1d086028e87f69ffb498c1451b</id>
<content type='text'>
Update "git difftool" and "git mergetool" so that the combinations
of {diff,merge}.{tool,guitool} configuration variables serve as
fallback settings of each other in a sensible order.

* dl/difftool-mergetool:
  difftool: fallback on merge.guitool
  difftool: make --gui, --tool and --extcmd mutually exclusive
  mergetool: fallback to tool when guitool unavailable
  mergetool--lib: create gui_mode function
  mergetool: use get_merge_tool function
  t7610: add mergetool --gui tests
  t7610: unsuppress output
</content>
</entry>
<entry>
<title>mergetool: fallback to tool when guitool unavailable</title>
<updated>2019-05-13T14:11:59Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2019-04-29T06:21:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=60aced3dfa68df60952fed28c4ae63a5bbda0275'/>
<id>urn:sha1:60aced3dfa68df60952fed28c4ae63a5bbda0275</id>
<content type='text'>
In git-difftool, if the tool is called with --gui but `diff.guitool` is
not set, it falls back to `diff.tool`. Make git-mergetool also fallback
from `merge.guitool` to `merge.tool` if the former is undefined.

If git-difftool, when called with `--gui`, were to use
`get_configured_mergetool` in a future patch, it would also get the
fallback behavior in the following precedence:

1. diff.guitool
2. merge.guitool
3. diff.tool
4. merge.tool

The behavior for when difftool or mergetool are called without `--gui`
should be identical with or without this patch.

Note that the search loop could be written as

	sections="merge"
	keys="tool"
	if diff_mode
	then
		sections="diff $sections"
	fi
	if gui_mode
	then
		keys="guitool $keys"
	fi

	merge_tool=$(
		IFS=' '
		for key in $keys
		do
			for section in $sections
			do
				selected=$(git config $section.$key)
				if test -n "$selected"
				then
					echo "$selected"
					return
				fi
			done
		done)

which would make adding a mode in the future much easier. However,
adding a new mode will likely never happen as it is highly discouraged
so, as a result, it is written in its current form so that it is more
readable for future readers.

Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
