1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-21 21:30:09 +00:00

refactor(fossil): use fossil branch current supported since v2.7 (#11138)

Using the automation-friendly "fossil branch current" feature added in
Fossil 2.7 instead of ad hoc parsing of human-readable "fossil branch"
output.  Not only does this fix a stray space in the output, it's more
robust against changes in command output in general.

Closes #11138
This commit is contained in:
Warren Young 2022-08-29 21:49:12 -06:00 committed by Marc Cornellà
parent 08d5c936c6
commit 34cd8fbd4a
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -13,12 +13,11 @@ ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
function fossil_prompt_info() {
local info=$(fossil branch 2>&1)
local branch=$(fossil branch current 2>&1)
# if we're not in a fossil repo, don't show anything
! command grep -q "use --repo" <<< "$info" || return
! command grep -q "use --repo" <<< "$branch" || return
local branch=$(echo $info | grep "* " | sed 's/* //g')
local changes=$(fossil changes)
local dirty="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"