robbyrussell/oh-my-zsh — pull request #780 by pilif (2011-12-28 14:09:03+00:00)
Title: make ZSH_THEME_GIT_PROMPT_AHEAD work consistently

While looking into the various prompt themes and how they are implemented, I noticed that there is a git_prompt_ahead() function in lib/git.zsh which is checking whether the current branch is ahead of the branch it tracks.

So far this has not been used by any theme, mainly because it doesn't get invoked by git_prompt_info()

I did also notice that git_prompt_ahead() was insisting on the git remote being called "origin" which is not always the case.

This pull request contains three commits which

1) make git_prompt_ahead determine the correct upstream to check against
2) add ZSH_THEME_GIT_PROMPT_AHEAD to git_prompt_info()

This way, a theme can define ZSH_THEME_GIT_PROMPT_AHEAD to tell the user if your branch is ahead of the branch it is tracking. And it will even work if the upstream is not called 'origin'.