From 2b96b7c54bbc86743d5550196e31f14b1b3d4951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 25 Nov 2021 11:46:37 +0100 Subject: [PATCH] fix(updater): stop update if `$ZSH` is not a git repository (#10448) Fixes #10448 --- tools/check_for_upgrade.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index a6fdf4659..b6625a395 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -133,6 +133,12 @@ function update_ohmyzsh() { return fi + # Test if Oh My Zsh directory is a git repository + if ! (cd "$ZSH" && LANG= git rev-parse &>/dev/null); then + echo >&2 "[oh-my-zsh] Can't update: not a git repository." + return + fi + # Check if there are updates available before proceeding if ! is_update_available; then return