parse-options: option to let --git-completion-helper show negative form
[gitweb.git] / t / t9902-completion.sh
index e6485feb0a0599769b8fba1a0ccd1f9fe41ba1fd..07c3e3b760f4355593d206c461c627a6f7e11011 100755 (executable)
@@ -1237,20 +1237,31 @@ test_expect_success 'double dash "git" itself' '
 test_expect_success 'double dash "git checkout"' '
        test_completion "git checkout --" <<-\EOF
        --quiet Z
+       --no-quiet Z
        --detach Z
+       --no-detach Z
        --track Z
+       --no-track Z
        --orphan=Z
+       --no-orphan Z
        --ours Z
+       --no-ours Z
        --theirs Z
+       --no-theirs Z
        --merge Z
+       --no-merge Z
        --conflict=Z
+       --no-conflict Z
        --patch Z
+       --no-patch Z
        --ignore-skip-worktree-bits Z
+       --no-ignore-skip-worktree-bits Z
        --ignore-other-worktrees Z
+       --no-ignore-other-worktrees Z
        --recurse-submodules Z
-       --progress Z
-       --no-track Z
        --no-recurse-submodules Z
+       --progress Z
+       --no-progress Z
        EOF
 '
 
@@ -1454,6 +1465,13 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c
        EOF
 '
 
+test_expect_success 'completion without explicit _git_xxx function' '
+       test_completion "git version --" <<-\EOF
+       --build-options Z
+       --no-build-options Z
+       EOF
+'
+
 test_expect_failure 'complete with tilde expansion' '
        git init tmp && cd tmp &&
        test_when_finished "cd .. && rm -rf tmp" &&
@@ -1497,4 +1515,35 @@ do
        '
 done
 
+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"
+'
+
+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" &&
+       . "$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"
+'
+
 test_done