mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
fix(updater): abort update if $ZSH is not a git repository
Fixes #12298
This commit is contained in:
parent
c262ffbb68
commit
56cfcb44e7
2 changed files with 17 additions and 5 deletions
12
lib/cli.zsh
12
lib/cli.zsh
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue