]> git.ipfire.org Git - thirdparty/git.git/commit - git-mergetool--lib.sh
mergetool: new config guiDefault supports auto-toggling gui by DISPLAY
authorTao Klerks <tao@klerks.biz>
Sat, 18 Mar 2023 15:27:43 +0000 (15:27 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Apr 2023 04:03:29 +0000 (21:03 -0700)
commit42943b950e12f2d3e56688ecef1b0502e162b436
treecc26a9949806fdd075ec1d24d813bf19dbe5e085
parentae73b2c8f1da39c39335ee76a0f95857712c22a7
mergetool: new config guiDefault supports auto-toggling gui by DISPLAY

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 <xmqqmtb8jsej.fsf@gitster.g>, 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 <tao@klerks.biz>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/difftool.txt
Documentation/config/mergetool.txt
Documentation/git-difftool.txt
Documentation/git-mergetool.txt
builtin/difftool.c
git-difftool--helper.sh
git-mergetool--lib.sh
git-mergetool.sh
t/t7610-mergetool.sh
t/t7800-difftool.sh