summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-01-15 21:48:46 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-01-15 21:48:46 -0800
commit073552d7ae5f34b93f9540787874c1ea0fff8051 (patch)
tree5af2b3b0c07e4b841e7145bfdd6ad9e40e626833
parentMerge branch 'ds/for-each-repo-noopfix' (diff)
parentmergetool--lib: fix '--tool-help' to correctly show available tools (diff)
downloadtgif-073552d7ae5f34b93f9540787874c1ea0fff8051.tar.xz
Merge branch 'pb/mergetool-tool-help-fix'
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
-rw-r--r--git-mergetool--lib.sh6
-rwxr-xr-xt/t7610-mergetool.sh11
2 files changed, 15 insertions, 2 deletions
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 7225abd811..78f3647ed9 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -46,9 +46,11 @@ show_tool_names () {
while read scriptname
do
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
- variants="$(echo "$variants" | sort | uniq)"
+ variants="$(echo "$variants" | sort -u)"
for toolname in $variants
do
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 70afdd06fa..6ac75b5d4c 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -828,4 +828,15 @@ test_expect_success 'mergetool -Oorder-file is honored' '
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