dir.c: fix missing dir invalidation in untracked code
[gitweb.git] / t / t9902-completion.sh
index cc9e741f929784582c418d25e919fd39ad426bfa..fc614dcbfa74c39e120ff2fc80cdec07ea16a338 100755 (executable)
@@ -400,6 +400,22 @@ test_expect_success '__gitdir - remote as argument' '
        test_cmp expected "$actual"
 '
 
+test_expect_success '__gitcomp_direct - puts everything into COMPREPLY as-is' '
+       sed -e "s/Z$//g" >expected <<-EOF &&
+       with-trailing-space Z
+       without-trailing-spaceZ
+       --option Z
+       --option=Z
+       $invalid_variable_name Z
+       EOF
+       (
+               cur=should_be_ignored &&
+               __gitcomp_direct "$(cat expected)" &&
+               print_comp
+       ) &&
+       test_cmp expected out
+'
+
 test_expect_success '__gitcomp - trailing space - options' '
        test_gitcomp "--re" "--dry-run --reuse-message= --reedit-message=
                --reset-author" <<-EOF
@@ -961,6 +977,17 @@ test_expect_success 'teardown after filtering matching refs' '
        git -C otherrepo branch -D matching/branch-in-other
 '
 
+test_expect_success '__git_refs - for-each-ref format specifiers in prefix' '
+       cat >expected <<-EOF &&
+       evil-%%-%42-%(refname)..master
+       EOF
+       (
+               cur="evil-%%-%42-%(refname)..mas" &&
+               __git_refs "" "" "evil-%%-%42-%(refname).." mas >"$actual"
+       ) &&
+       test_cmp expected "$actual"
+'
+
 test_expect_success '__git_complete_refs - simple' '
        sed -e "s/Z$//" >expected <<-EOF &&
        HEAD Z
@@ -1218,6 +1245,10 @@ test_expect_success 'double dash "git checkout"' '
        --conflict=
        --orphan Z
        --patch Z
+       --detach Z
+       --ignore-skip-worktree-bits Z
+       --recurse-submodules Z
+       --no-recurse-submodules Z
        EOF
 '
 
@@ -1430,4 +1461,38 @@ test_expect_failure 'complete with tilde expansion' '
        test_completion "git add ~/tmp/" "~/tmp/file"
 '
 
+test_expect_success 'setup other remote for remote reference completion' '
+       git remote add other otherrepo &&
+       git fetch other
+'
+
+for flag in -d --delete
+do
+       test_expect_success "__git_complete_remote_or_refspec - push $flag other" '
+               sed -e "s/Z$//" >expected <<-EOF &&
+               master-in-other Z
+               EOF
+               (
+                       words=(git push '$flag' other ma) &&
+                       cword=${#words[@]} cur=${words[cword-1]} &&
+                       __git_complete_remote_or_refspec &&
+                       print_comp
+               ) &&
+               test_cmp expected out
+       '
+
+       test_expect_failure "__git_complete_remote_or_refspec - push other $flag" '
+               sed -e "s/Z$//" >expected <<-EOF &&
+               master-in-other Z
+               EOF
+               (
+                       words=(git push other '$flag' ma) &&
+                       cword=${#words[@]} cur=${words[cword-1]} &&
+                       __git_complete_remote_or_refspec &&
+                       print_comp
+               ) &&
+               test_cmp expected out
+       '
+done
+
 test_done