diff options
author | Warren Young <wyoung@tangentsoft.com> | 2022-08-29 21:49:12 -0600 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2022-10-14 20:15:50 +0200 |
commit | 34cd8fbd4afce7b2beb3292f4f90ca57142f442c (patch) | |
tree | cd8fc72f07c826aac744fc6aa09cc9c518d9d013 /plugins/fossil | |
parent | 08d5c936c670bd7e37902f64a065ba9f74452cb9 (diff) | |
download | zsh-34cd8fbd4afce7b2beb3292f4f90ca57142f442c.tar.gz zsh-34cd8fbd4afce7b2beb3292f4f90ca57142f442c.tar.bz2 zsh-34cd8fbd4afce7b2beb3292f4f90ca57142f442c.zip |
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
Diffstat (limited to 'plugins/fossil')
-rw-r--r-- | plugins/fossil/fossil.plugin.zsh | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/plugins/fossil/fossil.plugin.zsh b/plugins/fossil/fossil.plugin.zsh index a2123f415..fadf6095d 100644 --- a/plugins/fossil/fossil.plugin.zsh +++ b/plugins/fossil/fossil.plugin.zsh @@ -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" |