|
|
@ -61,9 +61,7 @@ function +vi-git-remotebranch() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function +vi-git-tagname() {
|
|
|
|
function +vi-git-tagname() {
|
|
|
|
# Only show the tag name if we are not in DETACHED_HEAD state,
|
|
|
|
# If we are on a tag, append the tagname to the current branch string.
|
|
|
|
# or if the current branch's HEAD is the same commit as a tag but
|
|
|
|
|
|
|
|
# doesn't have the same name
|
|
|
|
|
|
|
|
local tag
|
|
|
|
local tag
|
|
|
|
tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
|
|
|
|
tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
|
|
|
|
|
|
|
|
|
|
|
@ -71,12 +69,15 @@ function +vi-git-tagname() {
|
|
|
|
# There is a tag that points to our current commit. Need to determine if we
|
|
|
|
# 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.
|
|
|
|
# are also on a branch, or are in a DETACHED_HEAD state.
|
|
|
|
if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then
|
|
|
|
if [[ -z $(git symbolic-ref HEAD 2>/dev/null) ]]; then
|
|
|
|
# DETACHED_HEAD state. Print the commit hash and tag name.
|
|
|
|
# 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
|
|
|
|
local revision
|
|
|
|
revision=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD)
|
|
|
|
revision=$(git rev-list -n 1 --abbrev-commit --abbrev=8 HEAD)
|
|
|
|
hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}"
|
|
|
|
hook_com[branch]="$(print_icon 'VCS_BRANCH_ICON')${revision} $(print_icon 'VCS_TAG_ICON')${tag}"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# We are on both a tag and a branch; print both.
|
|
|
|
# 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}"
|
|
|
|
hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|