Last active
December 26, 2015 03:59
-
-
Save forivall/7090131 to your computer and use it in GitHub Desktop.
Show git tag rather than just the abbreviated sha1 for vcs_info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (( ${+functions[vcs_info_hookadd]} )) || autoload -Uz vcs_info_hookadd | |
# vcs_info_hookadd set-message git-tag-instead-of-sha1 | |
# vcs_info_hookadd doesn't support dynamic hooks. :( | |
zstyle ':vcs_info:git*+set-message:*' hooks git-tag-instead-of-sha1 | |
+vi-git-tag-instead-of-sha1() { | |
if [[ ${hook_com[branch]} =~ ^[0-9a-f]+\.{3}$ ]] ; then | |
local tag=$(git name-rev --name-only --no-undefined --always HEAD) | |
if (( $? == 0 )) ; then | |
hook_com[branch]=$tag | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment