completion: ensure that the repository path given on the command line exists
[gitweb.git] / contrib / completion / git-completion.bash
index a43322b04a8e923edc7c2567a118966b35f6caa1..92801329268232a2ae048b0dea615f67069607e9 100644 (file)
@@ -40,6 +40,7 @@ __gitdir ()
 {
        if [ -z "${1-}" ]; then
                if [ -n "${__git_dir-}" ]; then
+                       test -d "$__git_dir" || return 1
                        echo "$__git_dir"
                elif [ -n "${GIT_DIR-}" ]; then
                        test -d "${GIT_DIR-}" || return 1