From 8669f50569f474afb547d1937d8bdf979877fbf3 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 5 Mar 2024 19:53:54 -0500 Subject: [PATCH] Don't show detached branch ref if we've already shown a tag. --- functions/fish_prompt.fish | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 01958f4..ebb3983 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -66,8 +66,11 @@ function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish and return end - set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null) - echo "$detached_glyph $branch" + # If we've already shown a tag we don't need to show a detached branch + if [ -z "$tag" ] + set -l branch (command git show-ref --head -s --abbrev | head -n1 2>/dev/null) + echo "$detached_glyph $branch" + end end function __bobthefish_hg_branch -S -d 'Get the current hg branch'