2b96b7c54bbc86743d5550196e31f14b1b3d4951

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(updater): stop update if `$ZSH` is not a git repository (#10448)

Fixes #10448

Diff

 1diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
 2index a6fdf4659c7c7e991c3c6b4517554b7a7bb11cc3..b6625a395caf7db1899978784632b897dcec87bc 100644
 3--- a/tools/check_for_upgrade.sh
 4+++ b/tools/check_for_upgrade.sh
 5@@ -133,6 +133,12 @@ function update_ohmyzsh() {
 6     return
 7   fi
 8 
 9+  # Test if Oh My Zsh directory is a git repository
10+  if ! (cd "$ZSH" && LANG= git rev-parse &>/dev/null); then
11+    echo >&2 "[oh-my-zsh] Can't update: not a git repository."
12+    return
13+  fi
14+
15   # Check if there are updates available before proceeding
16   if ! is_update_available; then
17     return