Fixed compatibility with older bash versions.
Older versions (like 3.2, current default on MacOS X) don't implement readarray.pull/649/head
parent
3fa0881281
commit
a2ac5b0096
|
|
@ -114,9 +114,7 @@ function git_status_summary {
|
||||||
if (!seen_header) {
|
if (!seen_header) {
|
||||||
print
|
print
|
||||||
}
|
}
|
||||||
print untracked
|
print untracked "\t" unstaged "\t" staged
|
||||||
print unstaged
|
|
||||||
print staged
|
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,12 +123,11 @@ function git_prompt_vars {
|
||||||
SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
|
SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
|
||||||
if [[ "$(git config --get bash-it.hide-status)" != "1" ]]; then
|
if [[ "$(git config --get bash-it.hide-status)" != "1" ]]; then
|
||||||
[[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && local git_status_flags='-uno'
|
[[ "${SCM_GIT_IGNORE_UNTRACKED}" = "true" ]] && local git_status_flags='-uno'
|
||||||
readarray -t status_lines < <((git status --porcelain ${git_status_flags} -b 2> /dev/null ||
|
local status_lines=$((git status --porcelain ${git_status_flags} -b 2> /dev/null ||
|
||||||
git status --porcelain ${git_status_flags} 2> /dev/null) | git_status_summary )
|
git status --porcelain ${git_status_flags} 2> /dev/null) | git_status_summary)
|
||||||
local status="${status_lines[0]}"
|
local status=$(awk 'NR==1' <<< "$status_lines")
|
||||||
local untracked_count="${status_lines[1]}"
|
local counts=$(awk 'NR==2' <<< "$status_lines")
|
||||||
local unstaged_count="${status_lines[2]}"
|
IFS=$'\t' read untracked_count unstaged_count staged_count <<< "$counts"
|
||||||
local staged_count="${status_lines[3]}"
|
|
||||||
if [[ "${untracked_count}" -gt 0 || "${unstaged_count}" -gt 0 || "${staged_count}" -gt 0 ]]; then
|
if [[ "${untracked_count}" -gt 0 || "${unstaged_count}" -gt 0 || "${staged_count}" -gt 0 ]]; then
|
||||||
SCM_DIRTY=1
|
SCM_DIRTY=1
|
||||||
if [[ "${SCM_GIT_SHOW_DETAILS}" = "true" ]]; then
|
if [[ "${SCM_GIT_SHOW_DETAILS}" = "true" ]]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue