diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-10-13 15:15:58 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-13 15:15:58 -0700 |
commit | 62f035aee3ff53aa9c5296d5acb4c4b683ba314d (patch) | |
tree | 8b2ff32deb4922a1468a672b68ecf2284fc09899 /t | |
parent | Merge branch 'jh/builtin-fsmonitor-part1' (diff) | |
parent | help: move column config discovery to help.c library (diff) | |
download | tgif-62f035aee3ff53aa9c5296d5acb4c4b683ba314d.tar.xz |
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
Diffstat (limited to 't')
-rwxr-xr-x | t/t0012-help.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/t/t0012-help.sh b/t/t0012-help.sh index 913f34c8e9..91b68c74a1 100755 --- a/t/t0012-help.sh +++ b/t/t0012-help.sh @@ -34,6 +34,18 @@ test_expect_success 'basic help commands' ' git help -a >/dev/null ' +test_expect_success 'invalid usage' ' + test_expect_code 129 git help -g add && + test_expect_code 129 git help -a -c && + + test_expect_code 129 git help -g add && + test_expect_code 129 git help -a -g && + + test_expect_code 129 git help -g -c && + test_expect_code 129 git help --config-for-completion add && + test_expect_code 129 git help --config-sections-for-completion add +' + test_expect_success "works for commands and guides by default" ' configure_help && git help status && @@ -89,6 +101,43 @@ test_expect_success 'git help succeeds without git.html' ' 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 ' |