Skip to content

Commit fa8b225

Browse files
committed
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
2 parents 268055b + ca2d62b commit fa8b225

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

parse-options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ static int show_gitcomp(const struct option *opts, int show_all)
585585
if (!opts->long_name)
586586
continue;
587587
if (!show_all &&
588-
(opts->flags & (PARSE_OPT_HIDDEN | PARSE_OPT_NOCOMPLETE)))
588+
(opts->flags & (PARSE_OPT_HIDDEN | PARSE_OPT_NOCOMPLETE | PARSE_OPT_FROM_ALIAS)))
589589
continue;
590590

591591
switch (opts->type) {

t/t9902-completion.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,19 @@ test_expect_success 'sourcing the completion script clears cached --options' '
24042404
verbose test -z "$__gitcomp_builtin_notes_edit"
24052405
'
24062406

2407+
test_expect_success 'option aliases are not shown by default' '
2408+
test_completion "git clone --recurs" "--recurse-submodules "
2409+
'
2410+
2411+
test_expect_success 'option aliases are shown with GIT_COMPLETION_SHOW_ALL' '
2412+
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
2413+
GIT_COMPLETION_SHOW_ALL=1 && export GIT_COMPLETION_SHOW_ALL &&
2414+
test_completion "git clone --recurs" <<-\EOF
2415+
--recurse-submodules Z
2416+
--recursive Z
2417+
EOF
2418+
'
2419+
24072420
test_expect_success '__git_complete' '
24082421
unset -f __git_wrap__git_main &&
24092422

0 commit comments

Comments
 (0)