mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
The original code would only match if the first line matched the
conditions. By adding the * after the # it now searches throughout the string. The only issues could be when filenames have spaces in them, specifically when the last letter of one section matches and then there's a space, or multiple spaces.
This commit is contained in:
parent
cd9b5774bb
commit
6a47668690
1 changed files with 10 additions and 10 deletions
20
lib/git.zsh
20
lib/git.zsh
|
|
@ -34,30 +34,30 @@ function git_prompt_long_sha() {
|
|||
git_prompt_status() {
|
||||
INDEX=$(git status --porcelain 2> /dev/null)
|
||||
STATUS=""
|
||||
if [ "${INDEX#?? }" != "$INDEX" ]; then
|
||||
if [ "${INDEX#*?? }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
|
||||
fi
|
||||
if [ "${INDEX#A }" != "$INDEX" ]; then
|
||||
if [ "${INDEX#*A }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
|
||||
elif [ "${INDEX#M }" != "$INDEX" ]; then
|
||||
elif [ "${INDEX#*M }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
|
||||
fi
|
||||
if [ "${INDEX# M }" != "$INDEX" ]; then
|
||||
if [ "${INDEX#* M }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
|
||||
elif [ "${INDEX#AM }" != "$INDEX" ]; then
|
||||
elif [ "${INDEX#*AM }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
|
||||
elif [ "${INDEX# T }" != "$INDEX" ]; then
|
||||
elif [ "${INDEX#* T }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
|
||||
fi
|
||||
if [ "${INDEX#R }" != "$INDEX" ]; then
|
||||
if [ "${INDEX#*R }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS"
|
||||
fi
|
||||
if [ "${INDEX# D }" != "$INDEX" ]; then
|
||||
if [ "${INDEX#* D }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
elif [ "${INDEX#AD }" != "$INDEX" ]; then
|
||||
elif [ "${INDEX#*AD }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
fi
|
||||
if [ "${INDEX#UU }" != "$INDEX" ]; then
|
||||
if [ "${INDEX#*UU }" != "$INDEX" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue