diff --git a/fish_prompt.fish b/fish_prompt.fish index f540561..1322c3e 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -52,11 +52,15 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish)' set -l ref (command git symbolic-ref HEAD ^/dev/null) - if [ $status -gt 0 ] - set -l branch (command git show-ref --head -s --abbrev | head -n1 ^/dev/null) - set ref "$__bobthefish_detached_glyph $branch" - end - echo $ref | sed "s#refs/heads/#$__bobthefish_branch_glyph #" + and echo $ref | sed "s#refs/heads/#$__bobthefish_branch_glyph #" + and return + + set -l tag (command git describe --tags --exact-match ^/dev/null) + and echo "$__bobthefish_tag_glyph $tag" + and return + + set -l branch (command git show-ref --head -s --abbrev | head -n1 ^/dev/null) + echo "$__bobthefish_detached_glyph $branch" end function __bobthefish_hg_branch -S -d 'Get the current hg branch'