1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-06 07:20:40 +01:00

fix(updater): abort update if $ZSH is not a git repository

Fixes #12298
This commit is contained in:
Marc Cornellà
2024-04-18 07:33:13 +02:00
parent c262ffbb68
commit 56cfcb44e7
2 changed files with 17 additions and 5 deletions

View File

@@ -773,7 +773,17 @@ function _omz::theme::use {
}
function _omz::update {
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
# Check if git command is available
(( $+commands[git] )) || {
_omz::log error "git is not installed. Aborting..."
return 1
}
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
[[ $? -eq 0 ]] || {
_omz::log error "\`$ZSH\` is not a git directory. Aborting..."
return 1
}
# Run update script
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default