summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2022-05-12 18:25:02 +0200
committerGitHub <noreply@github.com>2022-05-12 18:25:02 +0200
commitdfee71c7735b739d6db478b2353752aeb6bc1ae2 (patch)
tree24bce643966a87634348cb3afac347094c6c3f11 /lib
parentd7fc9b87f92fbd0c03eb99b8c69318468f69e61e (diff)
downloadzsh-dfee71c7735b739d6db478b2353752aeb6bc1ae2.tar.gz
zsh-dfee71c7735b739d6db478b2353752aeb6bc1ae2.tar.bz2
zsh-dfee71c7735b739d6db478b2353752aeb6bc1ae2.zip
Revert "fix(lib): don't return clean with `hide-dirty=1` in `parse_git_dirty`" (#10927)
Diffstat (limited to 'lib')
-rw-r--r--lib/git.zsh36
1 files changed, 16 insertions, 20 deletions
diff --git a/lib/git.zsh b/lib/git.zsh
index 390c0ad4b..be9fa7e67 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -34,30 +34,26 @@ function git_prompt_info() {
# Checks if working tree is dirty
function parse_git_dirty() {
- if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" == "1" ]]; then
- return 0
- fi
-
local STATUS
local -a FLAGS
FLAGS=('--porcelain')
- if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
- FLAGS+='--untracked-files=no'
+ if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
+ if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
+ FLAGS+='--untracked-files=no'
+ fi
+ case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
+ git)
+ # let git decide (this respects per-repo config in .gitmodules)
+ ;;
+ *)
+ # if unset: ignore dirty submodules
+ # other values are passed to --ignore-submodules
+ FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
+ ;;
+ esac
+ STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
fi
-
- case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
- git)
- # let git decide (this respects per-repo config in .gitmodules)
- ;;
- *)
- # if unset: ignore dirty submodules
- # other values are passed to --ignore-submodules
- FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
- ;;
- esac
-
- STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
- if [[ -n "$STATUS" ]]; then
+ if [[ -n $STATUS ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"