Skip to content

Commit

Permalink
Revert "fix(lib): don't return clean with hide-dirty=1 in `parse_gi…
Browse files Browse the repository at this point in the history
…t_dirty`" (ohmyzsh#10927)
  • Loading branch information
mcornella authored and kareefardi committed May 24, 2022
1 parent 99f1f58 commit 72efd12
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions lib/git.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 72efd12

Please sign in to comment.