Skip to content

Commit 81004df

Browse files
committedNov 6, 2014
2928 merge conflict
2 parents 1b65c55 + 2927ce3 commit 81004df

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed
 

‎lib/git.zsh

+15-16
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,20 @@ function git_prompt_info() {
1010

1111
# Checks if working tree is dirty
1212
parse_git_dirty() {
13-
local SUBMODULE_SYNTAX=''
14-
local GIT_STATUS=''
15-
local CLEAN_MESSAGE='nothing to commit (working directory clean)'
16-
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
13+
local STATUS=''
14+
local FLAGS
15+
FLAGS=('--porcelain')
16+
if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then
1717
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
18-
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
18+
FLAGS+='--ignore-submodules=dirty'
1919
fi
2020
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"
21+
FLAGS+='--untracked-files=no'
2922
fi
23+
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
24+
fi
25+
if [[ -n $STATUS ]]; then
26+
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
3027
else
3128
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
3229
fi
@@ -135,17 +132,19 @@ function git_compare_version() {
135132
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
136133

137134
for i in {1..3}; do
135+
if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then
136+
echo 1
137+
return 0
138+
fi
138139
if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
139140
echo -1
140141
return 0
141142
fi
142143
done
143-
echo 1
144+
echo 0
144145
}
145146

146147
#this is unlikely to change so make it all statically assigned
147148
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
148149
#clean up the namespace slightly by removing the checker function
149150
unset -f git_compare_version
150-
151-

2 commit comments

Comments
 (2)

javache commented on Nov 19, 2014

@javache

Wait, this undos the change in #2323 again :(

mcornella commented on Nov 19, 2014

@mcornella
Member

S****, sorry! I posted PR #3333 to fix it once and for all

Please sign in to comment.