Unverified Commit e606ac70 authored by Patrick Moore's avatar Patrick Moore Committed by GitHub
Browse files

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.
parent c4ac0d43
...@@ -14,10 +14,10 @@ function parse_git_dirty() { ...@@ -14,10 +14,10 @@ function parse_git_dirty() {
local -a FLAGS local -a FLAGS
FLAGS=('--porcelain') FLAGS=('--porcelain')
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then 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' FLAGS+='--untracked-files=no'
fi fi
case "$GIT_STATUS_IGNORE_SUBMODULES" in case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
git) git)
# let git decide (this respects per-repo config in .gitmodules) # let git decide (this respects per-repo config in .gitmodules)
;; ;;
......
...@@ -50,13 +50,13 @@ fi ...@@ -50,13 +50,13 @@ fi
# Runs before showing the prompt # Runs before showing the prompt
function omz_termsupport_precmd { function omz_termsupport_precmd {
[[ "$DISABLE_AUTO_TITLE" == true ]] && return [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
} }
# Runs before executing the command # Runs before executing the command
function omz_termsupport_preexec { function omz_termsupport_preexec {
[[ "$DISABLE_AUTO_TITLE" == true ]] && return [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
emulate -L zsh emulate -L zsh
setopt extended_glob setopt extended_glob
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment