omb-prompt-base: Add "." to git branch whitelist (#420)

* omb-prompt-base: Add "." to git branch whitelist

Add "." to git branch character whitelist to fix branches
like v6.0 or 5.4.2, as examples.

* Update lib/omb-prompt-base.sh

Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
This commit is contained in:
hiagofranco
2023-04-04 08:12:42 -03:00
committed by GitHub
parent c6f7d4fe9f
commit 3d14c374b9

View File

@@ -170,7 +170,8 @@ function scm_prompt_info_common {
function git_clean_branch {
local unsafe_ref=$(command git symbolic-ref -q HEAD 2> /dev/null)
local stripped_ref=${unsafe_ref##refs/heads/}
local clean_ref=${stripped_ref//[^a-zA-Z0-9\/_]/-}
local clean_ref=${stripped_ref//[\$\`\\]/-}
clean_ref=${clean_ref//[^[:print:]]/-} # strip escape sequences, etc.
echo $clean_ref
}