mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
Add variable to disable consideration repos with untracked files as dirty (#444)
Add `SCM_GIT_DISABLE_UNTRACKED_DIRTY="true"` setting for `lib/omb-prompt-base.sh`. Add this variable as well as `SCM_GIT_IGNORE_UNTRACKED` into the `.bashrc` template.
This commit is contained in:
@@ -30,6 +30,7 @@ THEME_BATTERY_PERCENTAGE_CHECK=${THEME_BATTERY_PERCENTAGE_CHECK:=true}
|
|||||||
|
|
||||||
SCM_GIT_SHOW_DETAILS=${SCM_GIT_SHOW_DETAILS:=true}
|
SCM_GIT_SHOW_DETAILS=${SCM_GIT_SHOW_DETAILS:=true}
|
||||||
SCM_GIT_SHOW_REMOTE_INFO=${SCM_GIT_SHOW_REMOTE_INFO:=auto}
|
SCM_GIT_SHOW_REMOTE_INFO=${SCM_GIT_SHOW_REMOTE_INFO:=auto}
|
||||||
|
SCM_GIT_DISABLE_UNTRACKED_DIRTY=${SCM_GIT_DISABLE_UNTRACKED_DIRTY:=false}
|
||||||
SCM_GIT_IGNORE_UNTRACKED=${SCM_GIT_IGNORE_UNTRACKED:=false}
|
SCM_GIT_IGNORE_UNTRACKED=${SCM_GIT_IGNORE_UNTRACKED:=false}
|
||||||
SCM_GIT_SHOW_CURRENT_USER=${SCM_GIT_SHOW_CURRENT_USER:=false}
|
SCM_GIT_SHOW_CURRENT_USER=${SCM_GIT_SHOW_CURRENT_USER:=false}
|
||||||
SCM_GIT_SHOW_MINIMAL_INFO=${SCM_GIT_SHOW_MINIMAL_INFO:=false}
|
SCM_GIT_SHOW_MINIMAL_INFO=${SCM_GIT_SHOW_MINIMAL_INFO:=false}
|
||||||
@@ -247,13 +248,14 @@ function git_prompt_vars {
|
|||||||
local counts=$(awk 'NR==2' <<< "$status_lines")
|
local counts=$(awk 'NR==2' <<< "$status_lines")
|
||||||
IFS=$'\t' read -r untracked_count unstaged_count staged_count <<< "$counts"
|
IFS=$'\t' read -r untracked_count unstaged_count staged_count <<< "$counts"
|
||||||
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
|
|
||||||
if [[ "${SCM_GIT_SHOW_DETAILS}" = "true" ]]; then
|
if [[ "${SCM_GIT_SHOW_DETAILS}" = "true" ]]; then
|
||||||
[[ "${staged_count}" -gt 0 ]] && details+=" ${SCM_GIT_STAGED_CHAR}${staged_count}" && SCM_DIRTY=3
|
[[ "${staged_count}" -gt 0 ]] && details+=" ${SCM_GIT_STAGED_CHAR}${staged_count}" && SCM_DIRTY=3
|
||||||
[[ "${unstaged_count}" -gt 0 ]] && details+=" ${SCM_GIT_UNSTAGED_CHAR}${unstaged_count}" && SCM_DIRTY=2
|
[[ "${unstaged_count}" -gt 0 ]] && details+=" ${SCM_GIT_UNSTAGED_CHAR}${unstaged_count}" && SCM_DIRTY=2
|
||||||
[[ "${untracked_count}" -gt 0 ]] && details+=" ${SCM_GIT_UNTRACKED_CHAR}${untracked_count}" && SCM_DIRTY=1
|
[[ "${untracked_count}" -gt 0 ]] && details+=" ${SCM_GIT_UNTRACKED_CHAR}${untracked_count}" &&
|
||||||
|
[[ "$SCM_GIT_DISABLE_UNTRACKED_DIRTY" != "true" ]] && SCM_DIRTY=1
|
||||||
fi
|
fi
|
||||||
SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
|
[[ "$SCM_GIT_DISABLE_UNTRACKED_DIRTY" != "true" || "${unstaged_count}" -gt 0 || "${staged_count}" -gt 0 ]] &&
|
||||||
|
SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -41,6 +41,14 @@ OSH_THEME="font"
|
|||||||
# much, much faster.
|
# much, much faster.
|
||||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||||
|
|
||||||
|
# Uncomment the following line if you don't want the repository to be considered dirty
|
||||||
|
# if there are untracked files.
|
||||||
|
# SCM_GIT_DISABLE_UNTRACKED_DIRTY="true"
|
||||||
|
|
||||||
|
# Uncomment the following line if you want to completely ignore the presence
|
||||||
|
# of untracked files in the repository.
|
||||||
|
# SCM_GIT_IGNORE_UNTRACKED="true"
|
||||||
|
|
||||||
# Uncomment the following line if you want to change the command execution time
|
# Uncomment the following line if you want to change the command execution time
|
||||||
# stamp shown in the history command output. One of the following values can
|
# stamp shown in the history command output. One of the following values can
|
||||||
# be used to specify the timestamp format.
|
# be used to specify the timestamp format.
|
||||||
|
Reference in New Issue
Block a user