676fb4e4203eae0f3755a729a6582eb32fe9834f

Author
Simon Buchan <simon.buchan@skilitics.com>
Committer
Simon Buchan <simon.buchan@skilitics.com>
Date

Message

Fix parse_git_dirty() when status.branch is set.

Diff

 1diff --git a/lib/git.zsh b/lib/git.zsh
 2index b0e73bf3ab5dabbfb0654b06c4c8f2c4bfbc2a16..8742a857af0f6d29b472f218ec03b4e799d53635 100644
 3--- a/lib/git.zsh
 4+++ b/lib/git.zsh
 5@@ -10,23 +10,20 @@ function git_prompt_info() {
 6 
 7 # Checks if working tree is dirty
 8 parse_git_dirty() {
 9-  local SUBMODULE_SYNTAX=''
10-  local GIT_STATUS=''
11-  local CLEAN_MESSAGE='nothing to commit (working directory clean)'
12+  local STATUS=''
13+  local FLAGS
14+  FLAGS=('--porcelain')
15   if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then
16     if [[ $POST_1_7_2_GIT -gt 0 ]]; then
17-          SUBMODULE_SYNTAX="--ignore-submodules=dirty"
18+      FLAGS+='--ignore-submodules=dirty'
19     fi
20     if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
21-        GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
22-    else
23-        GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
24-    fi
25-    if [[ -n $GIT_STATUS ]]; then
26-      echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
27-    else
28-      echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
29+      FLAGS+='--untracked-files=no'
30     fi
31+    STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
32+  fi
33+  if [[ -n $STATUS ]]; then
34+    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
35   else
36     echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
37   fi