Zsh super slow inside my Git repo

Posted by Jason Swett on Super User See other posts from Super User or by Jason Swett
Published on 2012-09-19T15:30:41Z Indexed on 2012/09/19 15:42 UTC
Read the original article Hit count: 275

Filed under:
|
|

My Zsh is super slow inside a certain Git repo of mine. When I Google "zsh git slow", I get a bunch of results about Git autocompletion being slow, but autocompletion isn't necessarily my problem; it's everything.

I tried removing all plugins and that, strangely, didn't do anything at all when I opened a new shell. Zsh would still do Git stuff inside my Git repo.

I found this snippet on this page:

function git_prompt_info() {
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
}

That made everything fast again, but it also gave me a prompt that looks like this:

?  snip git:(master

Note the missing right parenthesis. That's kind of lame. Plus the whole thing just seems like a hack I shouldn't have to do.

There's also this promising-looking SU question, but the links on the accepted answer are dead.

How can I get my Zsh not to be slow inside a Git repo?

© Super User or respective owner

Related posts about osx

Related posts about zsh