mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-26 04:30:27 +01:00
48528/0001: vcs_info git docs: ahead/behind commits: Don't run rev-list when that would fail
This commit is contained in:
parent
c231a2394f
commit
d9ac5916ba
2 changed files with 8 additions and 0 deletions
|
|
@ -179,6 +179,9 @@ function +vi-git-st() {
|
|||
local ahead behind
|
||||
local -a gitstatus
|
||||
|
||||
# Exit early in case the worktree is on a detached HEAD
|
||||
git rev-parse ${hook_com[branch]}@{upstream} >/dev/null 2>&1 || return 0
|
||||
|
||||
ahead=$(git rev-list --count ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null)
|
||||
(( $ahead )) && gitstatus+=( "+${ahead}" )
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue