dfee71c7735b739d6db478b2353752aeb6bc1ae2
- Author
- Marc Cornellà <hello@mcornella.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Revert "fix(lib): don't return clean with `hide-dirty=1` in `parse_git_dirty`" (#10927)
Diff
1diff --git a/lib/git.zsh b/lib/git.zsh
2index 390c0ad4b56fc1318d54c563f14a627acdfcfc6c..be9fa7e6750b2fb44ec463bb98c0e4dddce4547f 100644
3--- a/lib/git.zsh
4+++ b/lib/git.zsh
5@@ -34,30 +34,26 @@ function git_prompt_info() {
6
7 # Checks if working tree is dirty
8 function parse_git_dirty() {
9- if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" == "1" ]]; then
10- return 0
11- fi
12-
13 local STATUS
14 local -a FLAGS
15 FLAGS=('--porcelain')
16- if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
17- FLAGS+='--untracked-files=no'
18+ if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
19+ if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
20+ FLAGS+='--untracked-files=no'
21+ fi
22+ case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
23+ git)
24+ # let git decide (this respects per-repo config in .gitmodules)
25+ ;;
26+ *)
27+ # if unset: ignore dirty submodules
28+ # other values are passed to --ignore-submodules
29+ FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
30+ ;;
31+ esac
32+ STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
33 fi
34-
35- case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
36- git)
37- # let git decide (this respects per-repo config in .gitmodules)
38- ;;
39- *)
40- # if unset: ignore dirty submodules
41- # other values are passed to --ignore-submodules
42- FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
43- ;;
44- esac
45-
46- STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
47- if [[ -n "$STATUS" ]]; then
48+ if [[ -n $STATUS ]]; then
49 echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
50 else
51 echo "$ZSH_THEME_GIT_PROMPT_CLEAN"