<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-mergetool--lib.sh, branch v2.45.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.45.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.45.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2023-04-06T04:03:29Z</updated>
<entry>
<title>mergetool: new config guiDefault supports auto-toggling gui by DISPLAY</title>
<updated>2023-04-06T04:03:29Z</updated>
<author>
<name>Tao Klerks</name>
<email>tao@klerks.biz</email>
</author>
<published>2023-03-18T15:27:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=42943b950e12f2d3e56688ecef1b0502e162b436'/>
<id>urn:sha1:42943b950e12f2d3e56688ecef1b0502e162b436</id>
<content type='text'>
When no merge.tool or diff.tool is configured or manually selected, the
selection of a default tool is sensitive to the DISPLAY variable; in a
GUI session a gui-specific tool will be proposed if found, and
otherwise a terminal-based one. This "GUI-optimizing" behavior is
important because a GUI can make a huge difference to a user's ability
to understand and correctly complete a non-trivial conflicting merge.

Some time ago the merge.guitool and diff.guitool config options were
introduced to enable users to configure both a GUI tool, and a non-GUI
tool (with fallback if no GUI tool configured), in the same environment.

Unfortunately, the --gui argument introduced to support the selection of
the guitool is still explicit. When using configured tools, there is no
equivalent of the no-tool-configured "propose a GUI tool if we are in a GUI
environment" behavior.

As proposed in &lt;xmqqmtb8jsej.fsf@gitster.g&gt;, introduce new configuration
options, difftool.guiDefault and mergetool.guiDefault, supporting a special
value "auto" which causes the corresponding tool or guitool to be selected
depending on the presence of a non-empty DISPLAY value. Also support "true"
to say "default to the guitool (unless --no-gui is passed on the
commandline)", and "false" as the previous default behavior when these new
configuration options are not specified.

Signed-off-by: Tao Klerks &lt;tao@klerks.biz&gt;
Acked-by: David Aguilar &lt;davvid@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>vimdiff: add tool documentation</title>
<updated>2022-04-03T22:09:52Z</updated>
<author>
<name>Fernando Ramos</name>
<email>greenfoo@u92.eu</email>
</author>
<published>2022-03-30T19:19:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7b5cf8be180940ce099c8413d02fb5707d900708'/>
<id>urn:sha1:7b5cf8be180940ce099c8413d02fb5707d900708</id>
<content type='text'>
Running 'git {merge,diff}tool --tool-help' now also prints usage
information about the vimdiff tool (and its variants) instead of just
its name.

Two new functions ('diff_cmd_help()' and 'merge_cmd_help()') have been
added to the set of functions that each merge tool (ie. scripts found
inside "mergetools/") can overwrite to provided tool specific
information.

Right now, only 'mergetools/vimdiff' implements these functions, but
other tools are encouraged to do so in the future, specially if they
take configuration options not explained anywhere else (as it is the
case with the 'vimdiff' tool and the new 'layout' option)

Note that the function 'show_tool_names', used in the implementation of
'git mergetool --tool-help', is also used in Documentation/Makefile to
generate the list of allowed values for the configuration variables
'{diff,merge}.{gui,}tool'. Adjust the rule so its output is an Asciidoc
"description list" instead of a plain list, with the tool name as the
item and the newly added tool description as the description.

In addition, a section has been added to
"Documentation/git-mergetool.txt" to explain the new "layout"
configuration option with examples.

Helped-by: Philippe Blain &lt;levraiphilippeblain@gmail.com&gt;
Signed-off-by: Fernando Ramos &lt;greenfoo@u92.eu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<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>
</feed>
