summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2021-11-25 11:46:37 +0100
committerMarc Cornellà <hello@mcornella.com>2021-11-25 23:36:38 +0100
commit2b96b7c54bbc86743d5550196e31f14b1b3d4951 (patch)
tree2a6de8a3f404b0198eb68d34c09b2ad8219fcb41 /tools
parent15fd9c84deae400ba52451d75548fb8f6ec26bcf (diff)
downloadzsh-2b96b7c54bbc86743d5550196e31f14b1b3d4951.tar.gz
zsh-2b96b7c54bbc86743d5550196e31f14b1b3d4951.tar.bz2
zsh-2b96b7c54bbc86743d5550196e31f14b1b3d4951.zip
fix(updater): stop update if `$ZSH` is not a git repository (#10448)
Fixes #10448
Diffstat (limited to 'tools')
-rw-r--r--tools/check_for_upgrade.sh6
1 files changed, 6 insertions, 0 deletions
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