Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


git-info ahead/behind check broken #566

pikeas opened this Issue · 13 comments

2 participants


I'm setting up a new Mac, so everything is up-to-date - latest OS X Mavericks, latest clone of prezto, etc. Git version is

Symptom: After every shell command, the following is output:

git-info:165: bad math expression: operator expected at `0'
git-info:173: bad math expression: operator expected at `0'

I did some digging in that file (modules/git/functions/git-info). From line 250 (not either of the lines from the error, interestingly), we have:

ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}'
ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"

if [[ -n "$ahead_format" ]]; then
  if (( ahead > 0 )); then

$ahead is set to (num)(some sort of whitespace)(num), which means the [(w)1] has failed to split the string, which then causes the comparison to zero to throw an error.

My shell-fu is not strong, so I don't know how to correctly split $ahead_or_behind.


What's your Zsh version?


zsh 5.0.2


If you install the latest Zsh from Homebrew, does it still occur?


Installed zsh 5.0.5, which is the version present on brew.

Still broken.


I'm sorry, but I can't replicate this. It works on my end.


Is there anything else I can do to help test and figure this out? Prezto is really critical to my workflow.

Since this is a fresh install of OS X Mavericks on a new machine, I'd expect this to affect more users over time as they upgrade their OS and/or machine. Let's get to the bottom of this. :-)


If you can share the code, zip up your repository as is on your machine and let me download it.


Just recloned your repo, same problem. Do you still want a zip?



What happens if you change ahead to $ahead in the if statement?


Doesn't help, because ahead is set to (NUM1) (NUM2). It's the [(w)1] that's causing the issue, it's not pulling out NUM1 as expected.


It's documented in man zshexpn.

What about (W: :)?


If you have an IRC client, #zsh on Freenode may be of help as well.


The culprit turned out to be a virtualenv postactivate script which modified IFS and didn't unset it when finished.

@pikeas pikeas closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.