Handle unset variables in various parts of the codebase (#8944)

DISABLE_UNTRACKED_FILES_DIRTY, DISABLE_AUTO_TITLE, GIT_STATUS_IGNORE_SUBMODULES are not set
Handle these variables not being set with conditional access.

If the user has set -u option to report attempts to use undeclared / unassigned variable, accessing the variables needs to be conditional.
This commit is contained in:
Patrick Moore
2020-06-30 09:54:27 -07:00
committed by GitHub
parent c4ac0d43ad
commit e606ac7051
2 changed files with 4 additions and 4 deletions

View File

@@ -14,10 +14,10 @@ function parse_git_dirty() {
local -a FLAGS
FLAGS=('--porcelain')
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
FLAGS+='--untracked-files=no'
fi
case "$GIT_STATUS_IGNORE_SUBMODULES" in
case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
git)
# let git decide (this respects per-repo config in .gitmodules)
;;