]> git.madduck.net Git - etc/zsh.git/blobdiff - .zsh/zshrc/85_vcs_prompt

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Proper detection of VCS type
[etc/zsh.git] / .zsh / zshrc / 85_vcs_prompt
index 81e7773ec683be84e63e3115da1d58f86c1ad22b..d99251141f5e69c55e1f9106caa5b52f82882724 100644 (file)
@@ -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()