Skip to content

Commit

Permalink
Fix issue with weird branch errors in theme
Browse files Browse the repository at this point in the history
closes #11

Signed-off-by: Zachary Auerbach <[email protected]>
  • Loading branch information
Topher Lubaway authored and zaksoup committed Jul 18, 2016
1 parent af000cc commit ec8330d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions zagnoster.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,19 @@ prompt_git() {
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info

branch_name="$(git rev-parse --abbrev-ref HEAD)"
diff_up="$(git rev-list HEAD..origin/$branch_name --count)"
diff_down="$(git rev-list origin/$branch_name..HEAD --count)"

if [[ $diff_up != "0" ]]; then
echo -n "$diff_up"
fi
upstream_branch_name="$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null)"
if [ -n "$upstream_branch_name" ]; then
branch_name="$(git rev-parse --abbrev-ref HEAD)"
diff_up="$(git rev-list HEAD..$upstream_branch_name --count)"
diff_down="$(git rev-list $upstream_branch_name..HEAD --count)"

if [[ $diff_up != "0" ]]; then
echo -n "$diff_up"
fi

if [[ $diff_down != "0" ]]; then
echo -n "$diff_down"
if [[ $diff_down != "0" ]]; then
echo -n "$diff_down"
fi
fi

echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
Expand Down

0 comments on commit ec8330d

Please sign in to comment.