we can't just run e.g. a git command because that wouldn't find another repo
type in a subdir of a git repo. so we do it iteratively by checking for the
directories, which is suboptimal but should work.
__vcs_get_repo_type()
{
- if __git_get_repo_root >/dev/null; then
- echo git
- else
- echo NONE
- fi
+ while true; do
+ [ -d .git ] && echo git && break
+ [ -d .bzr ] && echo bzr && break
+ [ -d .hg ] && echo hg && break
+ [ -d .svn ] && echo svn && break
+ [ -d CVS ] && echo cvs && break
+ [ "$PWD" = / ] && echo NONE && return 1
+ cd ..
+ done
}
__vcs_set_prompt_variables()