]> git.madduck.net Git - etc/zsh.git/commitdiff

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:

cleanup and prevent running as root
authormartin f. krafft <madduck@madduck.net>
Tue, 6 May 2008 07:19:28 +0000 (08:19 +0100)
committermartin f. krafft <madduck@madduck.net>
Tue, 6 May 2008 07:19:28 +0000 (08:19 +0100)
.zsh/zshrc/85_vcs_prompt [moved from .zsh/zshrc/85_git_prompt with 79% similarity]

similarity index 79%
rename from .zsh/zshrc/85_git_prompt
rename to .zsh/zshrc/85_vcs_prompt
index 32d0e4ff608a8a3b0f856823f6523ea44d975a49..63ccb6517abb2440038af2b5d2711f39156edcff 100644 (file)
@@ -89,21 +89,25 @@ __vcs_set_prompt_variables()
   psvar[3]="$post"
 }
 
-update_git_vars_if_git_ran() {
-  local vcs="$(__vcs_get_repo_type)"
-  case "$(history $(($HISTCMD - 1)))" in
-    # $vcs appeared in last command, so be sure to update
-    *${vcs}*) __vcs_set_prompt_variables
-  esac
-}
-precmd_functions+=update_git_vars_if_git_ran
+if ! is_root; then
+  # too dangerous to be run as root
 
-update_git_vars() {
-  __vcs_set_prompt_variables
-}
-chpwd_functions+=update_git_vars
+  _update_vcs_prompt_vars_if_vcs_ran() {
+    local vcs="$(__vcs_get_repo_type)"
+    case "$(history $(($HISTCMD - 1)))" in
+      # $vcs appeared in last command, so be sure to update
+      *${vcs}*) __vcs_set_prompt_variables
+    esac
+  }
+  precmd_functions+=_update_vcs prompt_vars_if_vcs_ran
+
+  _update_vcs_prompt_vars() {
+    __vcs_set_prompt_variables
+  }
+  chpwd_functions+=_update_vcs_prompt_vars
+fi
 
 # call it once
-update_git_vars
+_update_vcs_prompt_vars
 
 # vim:ft=zsh