1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-25 21:40:08 +00:00

Get rid of wc dependency when showing ahead/behind info

This commit is contained in:
Dominik Ritter 2018-11-03 03:06:49 +01:00
parent ad14807cef
commit cd0ad84b01

View file

@ -33,12 +33,12 @@ function +vi-git-aheadbehind() {
# 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/${branch_name}..HEAD | wc -l)
ahead=$(command git rev-list "${branch_name}"@{upstream}..HEAD 2>/dev/null | wc -l) ahead=$(command git rev-list --count "${branch_name}"@{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/${branch_name} | wc -l)
behind=$(command git rev-list HEAD.."${branch_name}"@{upstream} 2>/dev/null | wc -l) behind=$(command git rev-list --count HEAD.."${branch_name}"@{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}