diff options
author | Anton Eicher <antone@antone-3.desktop.amazon.com> | 2012-12-19 07:22:03 -0800 |
---|---|---|
committer | Anton Eicher <antone@antone-3.desktop.amazon.com> | 2012-12-19 07:22:03 -0800 |
commit | fdb3c0e68d36d20d1b75163755d568d42def5ac1 (patch) | |
tree | dd12201709b387190576e62dba5247dc3038606b /plugins | |
parent | 397c085a19a22f6be515665835d09a2505cb3f23 (diff) | |
download | zsh-fdb3c0e68d36d20d1b75163755d568d42def5ac1.tar.gz zsh-fdb3c0e68d36d20d1b75163755d568d42def5ac1.tar.bz2 zsh-fdb3c0e68d36d20d1b75163755d568d42def5ac1.zip |
Added check for .git directory in current, before wasting time querying git. This saves seconds on my pc.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/git/git.plugin.zsh | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 154aa6db1..79300a166 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -73,12 +73,14 @@ alias gsd='git svn dcommit' # Usage example: git pull origin $(current_branch) # function current_branch() { + if [ ! -d .git ]; then return; fi ref=$(git symbolic-ref HEAD 2> /dev/null) || \ ref=$(git rev-parse --short HEAD 2> /dev/null) || return echo ${ref#refs/heads/} } function current_repository() { + if [ ! -d .git ]; then return; fi ref=$(git symbolic-ref HEAD 2> /dev/null) || \ ref=$(git rev-parse --short HEAD 2> /dev/null) || return echo $(git remote -v | cut -d':' -f 2) |