Merge branch 'pb/mergetool-tool-help-fix' into maint

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
This commit is contained in:
Junio C Hamano 2021-02-05 16:31:24 -08:00
commit 64971f0ac0
2 changed files with 15 additions and 2 deletions

View File

@ -46,9 +46,11 @@ show_tool_names () {
while read scriptname while read scriptname
do do
setup_tool "$scriptname" 2>/dev/null setup_tool "$scriptname" 2>/dev/null
variants="$variants$(list_tool_variants)\n" # We need an actual line feed here
variants="$variants
$(list_tool_variants)"
done done
variants="$(echo "$variants" | sort | uniq)" variants="$(echo "$variants" | sort -u)"
for toolname in $variants for toolname in $variants
do do

View File

@ -828,4 +828,15 @@ test_expect_success 'mergetool -Oorder-file is honored' '
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'mergetool --tool-help shows recognized tools' '
# Check a few known tools are correctly shown
git mergetool --tool-help >mergetools &&
grep vimdiff mergetools &&
grep vimdiff3 mergetools &&
grep gvimdiff2 mergetools &&
grep araxis mergetools &&
grep xxdiff mergetools &&
grep meld mergetools
'
test_done test_done