summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-06-01 06:06:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-01 06:06:37 (GMT)
commit2289880f784326dc955f213072164539dcaf445e (patch)
tree3e6d5465c144c76ffacde79aa33f9252b1e53a6e /t
parent2161ed80980dc774521b963d8b4b18f746124283 (diff)
parent6532f3740b1c228c0a2a03a4126f4f7e4f2d73e7 (diff)
downloadgit-2289880f784326dc955f213072164539dcaf445e.zip
git-2289880f784326dc955f213072164539dcaf445e.tar.gz
git-2289880f784326dc955f213072164539dcaf445e.tar.bz2
Merge branch 'nd/command-list'
The list of commands with their various attributes were spread across a few places in the build procedure, but it now is getting a bit more consolidated to allow more automation. * nd/command-list: completion: allow to customize the completable command list completion: add and use --list-cmds=alias completion: add and use --list-cmds=nohelpers Move declaration for alias.c to alias.h completion: reduce completable command list completion: let git provide the completable command list command-list.txt: documentation and guide line help: use command-list.txt for the source of guides help: add "-a --verbose" to list all commands with synopsis git: support --list-cmds=list-<category> completion: implement and use --list-cmds=main,others git --list-cmds: collect command list in a string_list git.c: convert --list-* to --list-cmds=* Remove common-cmds.h help: use command-list.h for common command list generate-cmds.sh: export all commands to command-list.h generate-cmds.sh: factor out synopsis extract code
Diffstat (limited to 't')
-rwxr-xr-xt/t0012-help.sh26
-rwxr-xr-xt/t9902-completion.sh23
2 files changed, 28 insertions, 21 deletions
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index 487b92a..bc27df7 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -25,6 +25,15 @@ test_expect_success "setup" '
EOF
'
+# make sure to exercise these code paths, the output is a bit tricky
+# to verify
+test_expect_success 'basic help commands' '
+ git help >/dev/null &&
+ git help -a >/dev/null &&
+ git help -g >/dev/null &&
+ git help -av >/dev/null
+'
+
test_expect_success "works for commands and guides by default" '
configure_help &&
git help status &&
@@ -49,8 +58,23 @@ test_expect_success "--help does not work for guides" "
test_i18ncmp expect actual
"
+test_expect_success 'git help' '
+ git help >help.output &&
+ test_i18ngrep "^ clone " help.output &&
+ test_i18ngrep "^ add " help.output &&
+ test_i18ngrep "^ log " help.output &&
+ test_i18ngrep "^ commit " help.output &&
+ test_i18ngrep "^ fetch " help.output
+'
+test_expect_success 'git help -g' '
+ git help -g >help.output &&
+ test_i18ngrep "^ attributes " help.output &&
+ test_i18ngrep "^ everyday " help.output &&
+ test_i18ngrep "^ tutorial " help.output
+'
+
test_expect_success 'generate builtin list' '
- git --list-builtins >builtins
+ git --list-cmds=builtins >builtins
'
while read builtin
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 1b6d275..36deb0b 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -13,7 +13,7 @@ complete ()
return 0
}
-# Be careful when updating this list:
+# Be careful when updating these lists:
#
# (1) The build tree may have build artifact from different branch, or
# the user's $PATH may have a random executable that may begin
@@ -30,7 +30,8 @@ complete ()
# completion for "git <TAB>", and a plumbing is excluded. "add",
# "filter-branch" and "ls-files" are listed for this.
-GIT_TESTING_COMMAND_COMPLETION='add checkout check-attr filter-branch ls-files'
+GIT_TESTING_ALL_COMMAND_LIST='add checkout check-attr filter-branch ls-files'
+GIT_TESTING_PORCELAIN_COMMAND_LIST='add checkout filter-branch'
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
@@ -1350,17 +1351,6 @@ test_expect_success '__git_pretty_aliases' '
test_cmp expect actual
'
-test_expect_success '__git_aliases' '
- cat >expect <<-EOF &&
- ci
- co
- EOF
- test_config alias.ci commit &&
- test_config alias.co checkout &&
- __git_aliases >actual &&
- test_cmp expect actual
-'
-
test_expect_success 'basic' '
run_completion "git " &&
# built-in
@@ -1670,13 +1660,6 @@ test_expect_success 'sourcing the completion script clears cached commands' '
verbose test -z "$__git_all_commands"
'
-test_expect_success 'sourcing the completion script clears cached porcelain commands' '
- __git_compute_porcelain_commands &&
- verbose test -n "$__git_porcelain_commands" &&
- . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
- verbose test -z "$__git_porcelain_commands"
-'
-
test_expect_success !GETTEXT_POISON 'sourcing the completion script clears cached merge strategies' '
__git_compute_merge_strategies &&
verbose test -n "$__git_merge_strategies" &&