зеркало из https://github.com/microsoft/git.git
completion tests: re-source git-completion.bash in a subshell
Change tests of git-completion.bash that re-source it to do so inside a subshell. Re-sourcing it will clobber variables it sets, and in the case of the "GIT_COMPLETION_SHOW_ALL=1" test added inca2d62b787
(parse-options: don't complete option aliases by default, 2021-07-16) change the behavior of the completion persistently. Aside from the addition of "(" and ")" on new lines this is an indentation-only change, only the "(" and ")" lines are changed under "git diff -w". So let's change that test, and for good measure do the same for the three tests that precede it, which were added in8b0eaa41f2
(completion: clear cached --options when sourcing the completion script, 2018-03-22). The may not be wrong, but doing this establishes a more reliable pattern for future tests, which might use these as a template to copy. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
5d01301f2b
Коммит
59d9442f28
|
@ -2396,27 +2396,33 @@ test_expect_success 'options with value' '
|
|||
'
|
||||
|
||||
test_expect_success 'sourcing the completion script clears cached commands' '
|
||||
__git_compute_all_commands &&
|
||||
verbose test -n "$__git_all_commands" &&
|
||||
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
|
||||
verbose test -z "$__git_all_commands"
|
||||
(
|
||||
__git_compute_all_commands &&
|
||||
verbose test -n "$__git_all_commands" &&
|
||||
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
|
||||
verbose test -z "$__git_all_commands"
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'sourcing the completion script clears cached merge strategies' '
|
||||
__git_compute_merge_strategies &&
|
||||
verbose test -n "$__git_merge_strategies" &&
|
||||
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
|
||||
verbose test -z "$__git_merge_strategies"
|
||||
(
|
||||
__git_compute_merge_strategies &&
|
||||
verbose test -n "$__git_merge_strategies" &&
|
||||
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
|
||||
verbose test -z "$__git_merge_strategies"
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'sourcing the completion script clears cached --options' '
|
||||
__gitcomp_builtin checkout &&
|
||||
verbose test -n "$__gitcomp_builtin_checkout" &&
|
||||
__gitcomp_builtin notes_edit &&
|
||||
verbose test -n "$__gitcomp_builtin_notes_edit" &&
|
||||
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
|
||||
verbose test -z "$__gitcomp_builtin_checkout" &&
|
||||
verbose test -z "$__gitcomp_builtin_notes_edit"
|
||||
(
|
||||
__gitcomp_builtin checkout &&
|
||||
verbose test -n "$__gitcomp_builtin_checkout" &&
|
||||
__gitcomp_builtin notes_edit &&
|
||||
verbose test -n "$__gitcomp_builtin_notes_edit" &&
|
||||
. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" &&
|
||||
verbose test -z "$__gitcomp_builtin_checkout" &&
|
||||
verbose test -z "$__gitcomp_builtin_notes_edit"
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'option aliases are not shown by default' '
|
||||
|
@ -2424,12 +2430,14 @@ test_expect_success 'option aliases are not shown by default' '
|
|||
'
|
||||
|
||||
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
|
||||
(
|
||||
. "$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' '
|
||||
|
|
Загрузка…
Ссылка в новой задаче