From fd9312417d57c0c41e23395bece4be00c94dc8df Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 6 May 2008 21:47:29 +0100 Subject: [PATCH] Proper detection of VCS type 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. --- .zsh/zshrc/85_vcs_prompt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.zsh/zshrc/85_vcs_prompt b/.zsh/zshrc/85_vcs_prompt index 81e7773..d992511 100644 --- a/.zsh/zshrc/85_vcs_prompt +++ b/.zsh/zshrc/85_vcs_prompt @@ -52,11 +52,15 @@ __get_prompt_path_components() __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() -- 2.39.2