# Note: I modified the _cd() function in /etc/bash_completion to omit CVS
# directories if no CDPATH is set. The relevant part was before

    if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
        _filedir -d
        return 0
    fi

# and now reads

    if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
        _filedir -d
        if [[ -n "$cdignore" ]]; then
            k=0
            a=()
            for f in ${COMPREPLY[@]}; do
                i=0

                # only get the part after the last slash because for "lib/.svn"
                # we still want to be able to compare with ".svn"
                fpart=${f##*/}

                for v in ${cdignore[@]}; do
                    if [[ "$fpart" == "$v" ]]; then
                        i=1
                    fi
                done
                if [[ $i -eq 0 ]]; then
                    a[k++]=$f
                fi
            done
            COMPREPLY=( ${a[@]} )
        fi
        return 0
    fi
