vscode: wrap commit messages at column 72 by default
[gitweb.git] / t / t9902-completion.sh
index 1b6d27525454a1d14da91f53d45e39a659e48e36..3b3a7b66e41024b5a9b939f1c33a9996b8874a12 100755 (executable)
@@ -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"
 
@@ -180,7 +181,7 @@ test_expect_success '__git_find_repo_path - cwd is a .git directory' '
 test_expect_success '__git_find_repo_path - parent is a .git directory' '
        echo "$ROOT/.git" >expected &&
        (
-               cd .git/refs/heads &&
+               cd .git/objects &&
                __git_find_repo_path &&
                echo "$__git_repo_path" >"$actual"
        ) &&
@@ -500,6 +501,42 @@ test_expect_success '__gitcomp - suffix' '
        EOF
 '
 
+test_expect_success '__gitcomp - ignore optional negative options' '
+       test_gitcomp "--" "--abc --def --no-one -- --no-two" <<-\EOF
+       --abc Z
+       --def Z
+       --no-one Z
+       --no-... Z
+       EOF
+'
+
+test_expect_success '__gitcomp - ignore/narrow optional negative options' '
+       test_gitcomp "--a" "--abc --abcdef --no-one -- --no-two" <<-\EOF
+       --abc Z
+       --abcdef Z
+       EOF
+'
+
+test_expect_success '__gitcomp - ignore/narrow optional negative options' '
+       test_gitcomp "--n" "--abc --def --no-one -- --no-two" <<-\EOF
+       --no-one Z
+       --no-... Z
+       EOF
+'
+
+test_expect_success '__gitcomp - expand all negative options' '
+       test_gitcomp "--no-" "--abc --def --no-one -- --no-two" <<-\EOF
+       --no-one Z
+       --no-two Z
+       EOF
+'
+
+test_expect_success '__gitcomp - expand/narrow all negative options' '
+       test_gitcomp "--no-o" "--abc --def --no-one -- --no-two" <<-\EOF
+       --no-one Z
+       EOF
+'
+
 test_expect_success '__gitcomp - doesnt fail because of invalid variable name' '
        __gitcomp "$invalid_variable_name"
 '
@@ -1350,17 +1387,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
@@ -1408,8 +1434,8 @@ test_expect_success 'double dash "git checkout"' '
        --ignore-other-worktrees Z
        --recurse-submodules Z
        --progress Z
-       --no-track Z
-       --no-recurse-submodules Z
+       --no-quiet Z
+       --no-... Z
        EOF
 '
 
@@ -1617,6 +1643,7 @@ test_expect_success 'completion used <cmd> completion for alias: !f() { : git <c
 test_expect_success 'completion without explicit _git_xxx function' '
        test_completion "git version --" <<-\EOF
        --build-options Z
+       --no-build-options Z
        EOF
 '
 
@@ -1670,13 +1697,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" &&