summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-07-28 20:18:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-07-28 20:18:03 (GMT)
commitfa8b225d864e00703c048d49ff523c3980d6a3b4 (patch)
treeeb1415636af0e158048435fc1d9141746df5d652
parent268055bfdec5cc2228ade6f3ff7094632568c82a (diff)
parentca2d62b7879f4e1a28fcef349a82f56ce8a986b6 (diff)
downloadgit-fa8b225d864e00703c048d49ff523c3980d6a3b4.zip
git-fa8b225d864e00703c048d49ff523c3980d6a3b4.tar.gz
git-fa8b225d864e00703c048d49ff523c3980d6a3b4.tar.bz2
Merge branch 'pb/dont-complete-aliased-options'
The completion support used to offer alternate spelling of options that exist only for compatibility, which has been corrected. * pb/dont-complete-aliased-options: parse-options: don't complete option aliases by default
-rw-r--r--parse-options.c2
-rwxr-xr-xt/t9902-completion.sh13
2 files changed, 14 insertions, 1 deletions
diff --git a/parse-options.c b/parse-options.c
index e6f5676..2abff13 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -585,7 +585,7 @@ static int show_gitcomp(const struct option *opts, int show_all)
if (!opts->long_name)
continue;
if (!show_all &&
- (opts->flags & (PARSE_OPT_HIDDEN | PARSE_OPT_NOCOMPLETE)))
+ (opts->flags & (PARSE_OPT_HIDDEN | PARSE_OPT_NOCOMPLETE | PARSE_OPT_FROM_ALIAS)))
continue;
switch (opts->type) {
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index cb057ef..1157393 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -2404,6 +2404,19 @@ test_expect_success 'sourcing the completion script clears cached --options' '
verbose test -z "$__gitcomp_builtin_notes_edit"
'
+test_expect_success 'option aliases are not shown by default' '
+ test_completion "git clone --recurs" "--recurse-submodules "
+'
+
+test_expect_success 'option aliases are shown with GIT_COMPLETION_SHOW_ALL' '
+ . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
+ GIT_COMPLETION_SHOW_ALL=1 && export GIT_COMPLETION_SHOW_ALL &&
+ test_completion "git clone --recurs" <<-\EOF
+ --recurse-submodules Z
+ --recursive Z
+ EOF
+'
+
test_expect_success '__git_complete' '
unset -f __git_wrap__git_main &&