From 0e2b11ae9851525d24e5f4e2bb0919bf4f0fd788 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 11 Nov 2020 15:51:06 +0100 Subject: [PATCH 1/2] mergetools/bc: add `bc4` to the alias list for Beyond Compare As of 83bbf9b92ea8 (mergetool--lib: improve support for vimdiff-style tool variants, 2020-07-29), we already list `bc` and `bc3` as aliases for that mergetool/difftool. However, the current Beyond Compare version is _4_, therefore the `bc4` alias is missing from that list. Most notably, this is the root cause of the breakage reported in https://github.com/git-for-windows/git/issues/2893 where a well-configured `bc4` difftool stopped working as of v2.29.0: `setup_tool` would notice that after stripping off the trailing digit, it finds a match in `mergetools/` (the `bc` file), source it, and then the alias would not match the list offered by the `list_tool_variants` function, and simply exit without doing anything, but pretending success. Signed-off-by: Johannes Schindelin --- mergetools/bc | 1 + 1 file changed, 1 insertion(+) diff --git a/mergetools/bc b/mergetools/bc index a89086ee720f84..26c19d46a5bdee 100644 --- a/mergetools/bc +++ b/mergetools/bc @@ -25,4 +25,5 @@ translate_merge_tool_path() { list_tool_variants () { echo bc echo bc3 + echo bc4 } From c157c07d5d4917e6eef6717894f61c54cbc9af22 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 11 Nov 2020 15:59:26 +0100 Subject: [PATCH 2/2] mergetool: avoid letting `list_tool_variants` break user-defined setups 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 --- git-mergetool--lib.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 2defef28cd931f..7225abd81122e6 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 () {