From: Junio C Hamano Date: Wed, 13 Oct 2021 22:15:58 +0000 (-0700) Subject: Merge branch 'ab/help-config-vars' X-Git-Tag: v2.34.0-rc0~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=62f035aee3f;p=thirdparty%2Fgit.git Merge branch 'ab/help-config-vars' Teach "git help -c" into helping the command line completion of configuration variables. * ab/help-config-vars: help: move column config discovery to help.c library help / completion: make "git help" do the hard work help tests: test --config-for-completion option & output help: simplify by moving to OPT_CMDMODE() help: correct logic error in combining --all and --guides help: correct logic error in combining --all and --config help tests: add test for --config output help: correct usage & behavior of "git help --guides" help: correct the usage string in -h and documentation --- 62f035aee3ff53aa9c5296d5acb4c4b683ba314d diff --cc t/t0012-help.sh index 913f34c8e9,60d713021f..91b68c74a1 --- a/t/t0012-help.sh +++ b/t/t0012-help.sh @@@ -73,22 -85,43 +85,59 @@@ test_expect_success 'git help -g' test_i18ngrep "^ tutorial " help.output ' +test_expect_success 'git help fails for non-existing html pages' ' + configure_help && + mkdir html-empty && + test_must_fail git -c help.htmlpath=html-empty help status && + test_must_be_empty test-browser.log +' + +test_expect_success 'git help succeeds without git.html' ' + configure_help && + mkdir html-with-docs && + touch html-with-docs/git-status.html && + git -c help.htmlpath=html-with-docs help status && + echo "html-with-docs/git-status.html" >expect && + test_cmp expect test-browser.log +' + + test_expect_success 'git help -c' ' + git help -c >help.output && + cat >expect <<-\EOF && + + '\''git help config'\'' for more information + EOF + grep -v -E \ + -e "^[^.]+\.[^.]+$" \ + -e "^[^.]+\.[^.]+\.[^.]+$" \ + help.output >actual && + test_cmp expect actual + ' + + test_expect_success 'git help --config-for-completion' ' + git help -c >human && + grep -E \ + -e "^[^.]+\.[^.]+$" \ + -e "^[^.]+\.[^.]+\.[^.]+$" human | + sed -e "s/\*.*//" -e "s/<.*//" | + sort -u >human.munged && + + git help --config-for-completion >vars && + test_cmp human.munged vars + ' + + test_expect_success 'git help --config-sections-for-completion' ' + git help -c >human && + grep -E \ + -e "^[^.]+\.[^.]+$" \ + -e "^[^.]+\.[^.]+\.[^.]+$" human | + sed -e "s/\..*//" | + sort -u >human.munged && + + git help --config-sections-for-completion >sections && + test_cmp human.munged sections + ' + test_expect_success 'generate builtin list' ' git --list-cmds=builtins >builtins '