mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-24 08:01:57 +00:00
Get branch name from VCS_INFO subsystem when collecting ahead/behind info
This commit is contained in:
parent
cd0ad84b01
commit
fea5f616d1
1 changed files with 5 additions and 7 deletions
|
@ -26,19 +26,17 @@ function +vi-git-untracked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function +vi-git-aheadbehind() {
|
function +vi-git-aheadbehind() {
|
||||||
local ahead behind branch_name
|
local ahead behind
|
||||||
local -a gitstatus
|
local -a gitstatus
|
||||||
|
|
||||||
branch_name=$(command git symbolic-ref --short HEAD 2>/dev/null)
|
|
||||||
|
|
||||||
# for git prior to 1.7
|
# for git prior to 1.7
|
||||||
# ahead=$(command git rev-list origin/${branch_name}..HEAD | wc -l)
|
# ahead=$(command git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
|
||||||
ahead=$(command git rev-list --count "${branch_name}"@{upstream}..HEAD 2>/dev/null)
|
ahead=$(command git rev-list --count "${hook_com[branch]}"@{upstream}..HEAD 2>/dev/null)
|
||||||
(( ahead )) && gitstatus+=( " $(print_icon 'VCS_OUTGOING_CHANGES_ICON')${ahead// /}" )
|
(( ahead )) && gitstatus+=( " $(print_icon 'VCS_OUTGOING_CHANGES_ICON')${ahead// /}" )
|
||||||
|
|
||||||
# for git prior to 1.7
|
# for git prior to 1.7
|
||||||
# behind=$(command git rev-list HEAD..origin/${branch_name} | wc -l)
|
# behind=$(command git rev-list HEAD..origin/${hook_com[branch]} | wc -l)
|
||||||
behind=$(command git rev-list --count HEAD.."${branch_name}"@{upstream} 2>/dev/null)
|
behind=$(command git rev-list --count HEAD.."${hook_com[branch]}"@{upstream} 2>/dev/null)
|
||||||
(( behind )) && gitstatus+=( " $(print_icon 'VCS_INCOMING_CHANGES_ICON')${behind// /}" )
|
(( behind )) && gitstatus+=( " $(print_icon 'VCS_INCOMING_CHANGES_ICON')${behind// /}" )
|
||||||
|
|
||||||
hook_com[misc]+=${(j::)gitstatus}
|
hook_com[misc]+=${(j::)gitstatus}
|
||||||
|
|
Loading…
Reference in a new issue