From 3bd40175ebc436ec89a771af03281032841a1cc6 Mon Sep 17 00:00:00 2001 From: Pavel Zaikin Date: Mon, 25 Oct 2021 11:36:58 +0500 Subject: [PATCH] show git tags if any Without change tags not shown (because return happen earlier). With change tags shown if exists. --- functions/fish_prompt.fish | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 02bfe97..b9037d4 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -78,6 +78,9 @@ function __bobthefish_escape_regex -a str -d 'A backwards-compatible `string esc end function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish)' + set -l tag (command git describe --tags --exact-match 2>/dev/null) + and echo "$tag_glyph $tag " + set -l branch (command git symbolic-ref HEAD 2>/dev/null | string replace -r '^refs/heads/' '') and begin [ -n "$theme_git_default_branches" ] @@ -97,10 +100,6 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish and return end - set -l tag (command git describe --tags --exact-match 2>/dev/null) - and echo "$tag_glyph $tag" - and return - set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null) echo "$detached_glyph $branch" end