git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: pudinha <rogi@skylittlesystem.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 2/2] mergetool: avoid letting `list_tool_variants` break user-defined setups
Date: Wed, 11 Nov 2020 20:33:18 +0000	[thread overview]
Message-ID: <c157c07d5d4917e6eef6717894f61c54cbc9af22.1605126798.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.787.git.1605126798.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

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 <johannes.schindelin@gmx.de>
---
 git-mergetool--lib.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 2defef28cd..7225abd811 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -138,6 +138,10 @@ setup_user_tool () {
 	merge_cmd () {
 		( eval $merge_tool_cmd )
 	}
+
+	list_tool_variants () {
+		echo "$tool"
+	}
 }
 
 setup_tool () {
-- 
gitgitgadget

  parent reply	other threads:[~2020-11-11 20:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 20:33 [PATCH 0/2] difftool: fix user-defined Beyond Compare setups Johannes Schindelin via GitGitGadget
2020-11-11 20:33 ` [PATCH 1/2] mergetools/bc: add `bc4` to the alias list for Beyond Compare Johannes Schindelin via GitGitGadget
2020-11-11 20:33 ` Johannes Schindelin via GitGitGadget [this message]
2020-11-11 20:59   ` [PATCH 2/2] mergetool: avoid letting `list_tool_variants` break user-defined setups Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c157c07d5d4917e6eef6717894f61c54cbc9af22.1605126798.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=rogi@skylittlesystem.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).