aboutsummaryrefslogtreecommitdiff
path: root/functions/vcs.zsh
diff options
context:
space:
mode:
authorChris Hudson <chris@xetius.com>2016-07-08 00:40:26 +0300
committerChris Hudson <chris@xetius.com>2016-07-08 00:40:26 +0300
commitef2d01a2aa4ce3c6edcef990f780b8babcae8d07 (patch)
tree1601339ce423a89dfbbce878e0bde9a5ce587fdd /functions/vcs.zsh
parent467742286f42c1b72f3992121eafd5b5658ffc81 (diff)
Added POWERLEVEL9K_VCS_HIDE_TAGS variable to control displaying of vcs tags in segment
Diffstat (limited to 'functions/vcs.zsh')
-rw-r--r--functions/vcs.zsh38
1 files changed, 20 insertions, 18 deletions
diff --git a/functions/vcs.zsh b/functions/vcs.zsh
index 15f0177e..b2d87d30 100644
--- a/functions/vcs.zsh
+++ b/functions/vcs.zsh
@@ -61,24 +61,26 @@ function +vi-git-remotebranch() {
}
function +vi-git-tagname() {
- # If we are on a tag, append the tagname to the current branch string.
- local tag
- tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
-
- if [[ -n "${tag}" ]] ; then
- # There is a tag that points to our current commit. Need to determine if we
- # are also on a branch, or are in a DETACHED_HEAD state.
- if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then
- # DETACHED_HEAD state. We want to append the tag name to the commit hash
- # and print it. Unfortunately, `vcs_info` blows away the hash when a tag
- # exists, so we have to manually retrieve it and clobber the branch
- # string.
- local revision
- revision=$(git rev-list -n 1 --abbrev-commit --abbrev=${POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH} HEAD)
- hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}"
- else
- # We are on both a tag and a branch; print both by appending the tag name.
- hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}"
+ if [[ -z "${POWERLEVE9K_VCS_HIDE_TAGS}" ]]; then
+ # If we are on a tag, append the tagname to the current branch string.
+ local tag
+ tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
+
+ if [[ -n "${tag}" ]] ; then
+ # There is a tag that points to our current commit. Need to determine if we
+ # are also on a branch, or are in a DETACHED_HEAD state.
+ if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then
+ # DETACHED_HEAD state. We want to append the tag name to the commit hash
+ # and print it. Unfortunately, `vcs_info` blows away the hash when a tag
+ # exists, so we have to manually retrieve it and clobber the branch
+ # string.
+ local revision
+ revision=$(git rev-list -n 1 --abbrev-commit --abbrev=${POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH} HEAD)
+ hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}"
+ else
+ # We are on both a tag and a branch; print both by appending the tag name.
+ hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}"
+ fi
fi
fi
}