run-command: restrict PATH search to executable files
[gitweb.git] / t / t9902-completion.sh
index cc9e741f929784582c418d25e919fd39ad426bfa..5ed28135bea13a6c4082413044d8dcb205449c38 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