1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-15 18:30:08 +00:00

fix(updater): search for upstream remote if using non-conventional name (#11135)

Fixes #11135
This commit is contained in:
Marc Cornellà 2023-04-01 10:14:18 +02:00
parent 029a6d2de8
commit 6ef236dd99
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -1,5 +1,7 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
local ret=0 # exit code
# Protect against running with shells other than zsh # Protect against running with shells other than zsh
if [ -z "$ZSH_VERSION" ]; then if [ -z "$ZSH_VERSION" ]; then
exec zsh "$0" "$@" exec zsh "$0" "$@"
@ -181,17 +183,23 @@ fi
# Update upstream remote to ohmyzsh org # Update upstream remote to ohmyzsh org
git remote -v | while read remote url extra; do git remote -v | while read remote url extra; do
case "$url" in case "$url" in
https://github.com/robbyrussell/oh-my-zsh(|.git))
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
break ;;
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://github.com/robbyrussell/oh-my-zsh(|.git))
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git" # Update out-of-date "unauthenticated git protocol on port 9418" to https
break ;; 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" ;;
git@github.com:robbyrussell/oh-my-zsh(|.git))
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 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 done
# Set git-config values known to fix git errors # Set git-config values known to fix git errors