Merge branch 'fc/git-complete-helper' into fc/git-prompt-script
[gitweb.git] / t / t9902-completion.sh
index eb779d58a44f0e96c7b1ed37c64f73256a9a02db..c8f3ec6bec641f744dd926e61909f7c05faf6bfd 100755 (executable)
@@ -3,21 +3,9 @@
 # Copyright (c) 2012 Felipe Contreras
 #
 
-if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then
-       # we are in full-on bash mode
-       true
-elif type bash >/dev/null 2>&1; then
-       # execute in full-on bash mode
-       unset POSIXLY_CORRECT
-       exec bash "$0" "$@"
-else
-       echo '1..0 #SKIP skipping bash completion tests; bash not available'
-       exit 0
-fi
-
 test_description='test bash completion'
 
-. ./test-lib.sh
+. ./lib-bash.sh
 
 complete ()
 {
@@ -63,7 +51,7 @@ run_completion ()
        local _cword
        _words=( $1 )
        (( _cword = ${#_words[@]} - 1 ))
-       _git && print_comp
+       __git_wrap_git && print_comp
 }
 
 test_completion ()
@@ -223,4 +211,21 @@ test_expect_success 'general options' '
        test_completion "git --inf" "--info-path " &&
        test_completion "git --no-r" "--no-replace-objects "
 '
+
+test_expect_success 'general options plus command' '
+       test_completion "git --version check" "checkout " &&
+       test_completion "git --paginate check" "checkout " &&
+       test_completion "git --git-dir=foo check" "checkout " &&
+       test_completion "git --bare check" "checkout " &&
+       test_completion "git --help des" "describe " &&
+       test_completion "git --exec-path=foo check" "checkout " &&
+       test_completion "git --html-path check" "checkout " &&
+       test_completion "git --no-pager check" "checkout " &&
+       test_completion "git --work-tree=foo check" "checkout " &&
+       test_completion "git --namespace=foo check" "checkout " &&
+       test_completion "git --paginate check" "checkout " &&
+       test_completion "git --info-path check" "checkout " &&
+       test_completion "git --no-replace-objects check" "checkout "
+'
+
 test_done