sindresorhus / pure

Pretty, minimal and fast ZSH prompt
MIT License
13.22k stars 977 forks source link

Dirty submodules ignored if PURE_GIT_UNTRACKED_DIRTY=1 #582

Closed dc46and2 closed 2 years ago

dc46and2 commented 3 years ago

General information

If PURE_GIT_UNTRACKED_DIRTY=0, then the prompt will show the repo is dirty if submodules are dirty. However, if PURE_GIT_UNTRACKED_DIRTY=1 (the default), then dirty submodules are ignored. I would prefer that dirty submodules are never ignored.

System report (output of prompt_pure_system_report):

Other information

This patch fixes the issue for me, but maybe there was a good reason you were ignoring submodules?

diff --git a/pure.zsh b/pure.zsh
index 271c1cc..646f5e6 100644
--- a/pure.zsh
+++ b/pure.zsh
@@ -291,7 +291,7 @@ prompt_pure_async_git_dirty() {
    if [[ $untracked_dirty = 0 ]]; then
        command git diff --no-ext-diff --quiet --exit-code
    else
-       test -z "$(GIT_OPTIONAL_LOCKS=0 command git status --porcelain --ignore-submodules -u${untracked_git_mode})"
+       test -z "$(GIT_OPTIONAL_LOCKS=0 command git status --porcelain -u${untracked_git_mode})"
    fi

    return $?
mafredri commented 2 years ago

Hmm, this behavior is very confusing, we should at least have them behave the same way (either add --ignore-submodules to git diff or, as suggested, remove from git status).

The reason submodules are ignored is at least in part for performance reasons, see #102 for history.

Thoughts @sindresorhus?

sindresorhus commented 2 years ago

I don't use submodules, so I don't have strong feelings about it. As long as it doesn't affect performance too much, I'm fine with including it.