diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-11-03 05:08:32 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-11-03 05:08:32 +0300 |
commit | fea5f616d17b11446a48327b6719180adf577425 (patch) | |
tree | 58df7dc1d9539f0fe6e4076214e6ba0fb9006a43 /functions | |
parent | cd0ad84b0100ca14ddb30d93a53094c0e9343e40 (diff) |
Get branch name from VCS_INFO subsystem when collecting ahead/behind info
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/vcs.zsh | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/functions/vcs.zsh b/functions/vcs.zsh index 1478e0e2..50a77d49 100755 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -26,19 +26,17 @@ function +vi-git-untracked() { } function +vi-git-aheadbehind() { - local ahead behind branch_name + local ahead behind local -a gitstatus - branch_name=$(command git symbolic-ref --short HEAD 2>/dev/null) - # for git prior to 1.7 - # ahead=$(command git rev-list origin/${branch_name}..HEAD | wc -l) - ahead=$(command git rev-list --count "${branch_name}"@{upstream}..HEAD 2>/dev/null) + # ahead=$(command git rev-list origin/${hook_com[branch]}..HEAD | wc -l) + ahead=$(command git rev-list --count "${hook_com[branch]}"@{upstream}..HEAD 2>/dev/null) (( ahead )) && gitstatus+=( " $(print_icon 'VCS_OUTGOING_CHANGES_ICON')${ahead// /}" ) # for git prior to 1.7 - # behind=$(command git rev-list HEAD..origin/${branch_name} | wc -l) - behind=$(command git rev-list --count HEAD.."${branch_name}"@{upstream} 2>/dev/null) + # behind=$(command git rev-list HEAD..origin/${hook_com[branch]} | wc -l) + behind=$(command git rev-list --count HEAD.."${hook_com[branch]}"@{upstream} 2>/dev/null) (( behind )) && gitstatus+=( " $(print_icon 'VCS_INCOMING_CHANGES_ICON')${behind// /}" ) hook_com[misc]+=${(j::)gitstatus} |