aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorNiccolò Maggioni <nicco.maggioni@gmail.com>2016-04-11 22:37:28 +0300
committerNiccolò Maggioni <nicco.maggioni@gmail.com>2016-04-11 22:37:28 +0300
commitce16b087c6c0f51570903cf89d7e8b7f87287380 (patch)
tree91a9316f3960bc141db2a59cd0a78e93bbbd9386 /functions
parent1ab41d9a6c9e2a4f62e3ebaac71cb2a87dde20cb (diff)
Avoid tag/branch duplication if same value
Diffstat (limited to 'functions')
-rw-r--r--functions/vcs.zsh8
1 files changed, 6 insertions, 2 deletions
diff --git a/functions/vcs.zsh b/functions/vcs.zsh
index 368251b6..f112e6a1 100644
--- a/functions/vcs.zsh
+++ b/functions/vcs.zsh
@@ -67,8 +67,12 @@ function +vi-git-tagname() {
local tag
tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
- # Append the tag segment to the branch one
- [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}"
+ head=$(git describe --all)
+ # Make sure that detached head and tag differ in name
+ if [[ "${head}" != "${tag}" ]]; then
+ # Append the tag segment to the branch one
+ [[ -n "${tag}" ]] && hook_com[branch]+=" $(print_icon 'VCS_TAG_ICON')${tag}"
+ fi
fi
}