summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2023-04-01 10:14:18 +0200
committerMarc Cornellà <hello@mcornella.com>2023-04-01 10:15:59 +0200
commit6ef236dd99f2090b54911f9135d00ac37d6757ff (patch)
treeb475308c190e96d927e3d2e6d96df1154455de6a /tools
parent029a6d2de8681d52142129eb8b6ff0f20be9f0a6 (diff)
downloadzsh-6ef236dd99f2090b54911f9135d00ac37d6757ff.tar.gz
zsh-6ef236dd99f2090b54911f9135d00ac37d6757ff.tar.bz2
zsh-6ef236dd99f2090b54911f9135d00ac37d6757ff.zip
fix(updater): search for upstream remote if using non-conventional name (#11135)
Fixes #11135
Diffstat (limited to 'tools')
-rwxr-xr-xtools/upgrade.sh24
1 files changed, 16 insertions, 8 deletions
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index d9a372d13..34ff3f027 100755
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env zsh
+local ret=0 # exit code
+
# Protect against running with shells other than zsh
if [ -z "$ZSH_VERSION" ]; then
exec zsh "$0" "$@"
@@ -181,17 +183,23 @@ fi
# Update upstream remote to ohmyzsh org
git remote -v | while read remote url extra; do
case "$url" in
+ git://github.com/robbyrussell/oh-my-zsh(|.git))
+ # Update out-of-date "unauthenticated git protocol on port 9418" to https
+ git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git" ;;
https://github.com/robbyrussell/oh-my-zsh(|.git))
- git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
- break ;;
+ git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git" ;;
git@github.com:robbyrussell/oh-my-zsh(|.git))
- git remote set-url "$remote" "git@github.com:ohmyzsh/ohmyzsh.git"
- break ;;
- # Update out-of-date "unauthenticated git protocol on port 9418" to https
- git://github.com/robbyrussell/oh-my-zsh(|.git))
- git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
- break ;;
+ git remote set-url "$remote" "git@github.com:ohmyzsh/ohmyzsh.git" ;;
+ https://github.com/ohmyzsh/ohmyzsh(|.git)) ;;
+ git@github.com:ohmyzsh/ohmyzsh(|.git)) ;;
+ *) continue ;;
esac
+
+ # If we reach this point we have found the proper ohmyzsh upstream remote. If we don't,
+ # we'll only update from the set remote if `oh-my-zsh.remote` has been set to a remote,
+ # as when installing from a fork.
+ git config --local oh-my-zsh.remote "$remote"
+ break
done
# Set git-config values known to fix git errors