mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 05:40:08 +00:00
fix(mercurial): correctly check for untracked files in hg_dirty
(#2177)
Closes #2177 Closes #6197 Co-authored-by: Henrik Ravn <hravnx@gmail.com>
This commit is contained in:
parent
4119f53004
commit
1c07001896
1 changed files with 15 additions and 3 deletions
|
@ -91,13 +91,25 @@ function hg_prompt_info {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hg_dirty {
|
function hg_dirty {
|
||||||
local hg_status
|
# Do nothing if clean / dirty settings aren't defined
|
||||||
if ! hg_status="$(hg status -mar 2>/dev/null)"; then
|
if [[ -z "$ZSH_THEME_HG_PROMPT_DIRTY" && -z "$ZSH_THEME_HG_PROMPT_CLEAN" ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if there are modifications
|
||||||
|
local hg_status
|
||||||
|
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" = true ]]; then
|
||||||
|
if ! hg_status="$(hg status -q 2>/dev/null)"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! hg_status="$(hg status 2>/dev/null)"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# grep exits with 0 when dirty
|
# grep exits with 0 when dirty
|
||||||
if command grep -Eq '^\s*[ACDIM!?L]' <<< "$hg_status"; then
|
if command grep -Eq '^\s*[ACDIMR!?L].*$' <<< "$hg_status"; then
|
||||||
echo $ZSH_THEME_HG_PROMPT_DIRTY
|
echo $ZSH_THEME_HG_PROMPT_DIRTY
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue