diff options
author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2021-04-13 13:56:36 +0000 |
---|---|---|
committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2021-04-20 22:34:34 +0000 |
commit | d9ac5916ba17889abf094c1ac45d88f431338d9c (patch) | |
tree | dfa1971942d8cbcbbe05f63fbc09654fe30c3e3d /Misc | |
parent | c231a2394f59a691edb3d2daf9d9aefe5fce19da (diff) | |
download | zsh-d9ac5916ba17889abf094c1ac45d88f431338d9c.tar.gz zsh-d9ac5916ba17889abf094c1ac45d88f431338d9c.tar.xz zsh-d9ac5916ba17889abf094c1ac45d88f431338d9c.zip |
48528/0001: vcs_info git docs: ahead/behind commits: Don't run rev-list when that would fail
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/vcs_info-examples | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples index d33d0ceed..065ea6cb3 100644 --- a/Misc/vcs_info-examples +++ b/Misc/vcs_info-examples @@ -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}" ) |