mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-12-28 16:15:02 +01:00
48525: vcs_info git docs: ahead/behind commits: Run fewer external programs
This commit is contained in:
parent
a90d5ab901
commit
3b631babec
2 changed files with 7 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
2021-04-13 Tim Lee <progscriptclone@gmail.com>
|
||||
|
||||
* 48525: Misc/vcs_info-examples: vcs_info git docs: ahead/behind
|
||||
commits: Run fewer external programs
|
||||
|
||||
2021-04-12 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* 48439: Src/mem.c: remove macros that became unnecessary by 47785
|
||||
|
|
|
@ -179,14 +179,10 @@ function +vi-git-st() {
|
|||
local ahead behind
|
||||
local -a gitstatus
|
||||
|
||||
# for git prior to 1.7
|
||||
# ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
|
||||
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
ahead=$(git rev-list --count ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null)
|
||||
(( $ahead )) && gitstatus+=( "+${ahead}" )
|
||||
|
||||
# for git prior to 1.7
|
||||
# behind=$(git rev-list HEAD..origin/${hook_com[branch]} | wc -l)
|
||||
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
behind=$(git rev-list --count HEAD..${hook_com[branch]}@{upstream} 2>/dev/null)
|
||||
(( $behind )) && gitstatus+=( "-${behind}" )
|
||||
|
||||
hook_com[misc]+=${(j:/:)gitstatus}
|
||||
|
|
Loading…
Reference in a new issue