Change git-info verbose mode implementation
so it behaves alike the non-verbose mode. For example, in the "merge" special action context, files are being reported as both indexed and unindexed by `git diff-index` and `git diff-files` commands in non-verbose mode. That was not the case with the regular expressions used in the verbose mode.
This commit is contained in:
parent
449634a99e
commit
0df896c3f1
2 changed files with 5 additions and 9 deletions
|
@ -100,5 +100,5 @@ Second, format how the above attributes are displayed in prompts:
|
||||||
'rprompt' '[%R]'
|
'rprompt' '[%R]'
|
||||||
|
|
||||||
Last, add `$git_info[prompt]` to `$PROMPT` and `$git_info[rprompt]` to
|
Last, add `$git_info[prompt]` to `$PROMPT` and `$git_info[rprompt]` to
|
||||||
`$RPROMPT` respectively and call `git-info` in the `prompt_name_preexec` hook
|
`$RPROMPT` respectively and call `git-info` in the `prompt_name_precmd` hook
|
||||||
function.
|
function.
|
||||||
|
|
|
@ -258,15 +258,11 @@ git-info() {
|
||||||
local untracked
|
local untracked
|
||||||
# Get current status.
|
# Get current status.
|
||||||
while IFS=$'\n' read line; do
|
while IFS=$'\n' read line; do
|
||||||
# T (type change) is undocumented, see http://git.io/FnpMGw.
|
if [[ ${line:0:2} == '??' ]]; then
|
||||||
if [[ ${line} == \?\?\ * ]]; then
|
|
||||||
(( untracked++ ))
|
(( untracked++ ))
|
||||||
elif [[ ${line} == \ [DMT]\ * ]]; then
|
else
|
||||||
(( unindexed++ ))
|
[[ ${line:0:1} != ' ' ]] && (( indexed++ ))
|
||||||
elif [[ ${line} == [ACDMRT]\ \ * ]]; then
|
[[ ${line:1:1} != ' ' ]] && (( unindexed++ ))
|
||||||
(( indexed++ ))
|
|
||||||
elif [[ ${line} == ([ACMRT][DMT]|D[MT])\ * ]]; then
|
|
||||||
(( indexed++, unindexed++ ))
|
|
||||||
fi
|
fi
|
||||||
(( dirty++ ))
|
(( dirty++ ))
|
||||||
done < <(${(z)status_cmd} 2>/dev/null)
|
done < <(${(z)status_cmd} 2>/dev/null)
|
||||||
|
|
Loading…
Reference in a new issue