From c3185e8079a61b36be84def0aa2c49e89460b960 Mon Sep 17 00:00:00 2001 From: Darren Kidd Date: Fri, 16 Oct 2020 11:41:57 +1300 Subject: [PATCH] Check list of default GIT branches --- fish_prompt.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fish_prompt.fish b/fish_prompt.fish index c09dfea..4413926 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -76,9 +76,13 @@ 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)' + [ -n "$theme_git_default_branches" ] + or set -l theme_git_default_branches refs/heads/master refs/heads/main + set -l ref (command git symbolic-ref HEAD 2>/dev/null) and begin - [ "$theme_display_git_master_branch" != 'yes' -a \( "$ref" = 'refs/heads/master' -o "$ref" = 'refs/heads/main' \) ] + [ "$theme_display_git_master_branch" != 'yes' ] + and contains $ref $theme_git_default_branches and echo $branch_glyph and return