From 149643a31fc7587f5a7ca849200c0f690abbfb31 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Tue, 21 Jan 2025 18:01:51 +0100 Subject: [PATCH] git:https-and-ssh: Fix ssh -> https Apparently there was an issue with the conversion from ssh to https which I never noticed? The script would replace the colon of the `https://` and not the one after the domain: https///github.com:[...] I rewrote both cases in a simpler way while fixing the issue. --- .config/zsh/autoload/git/git-https-and-ssh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/zsh/autoload/git/git-https-and-ssh b/.config/zsh/autoload/git/git-https-and-ssh index e16b94c..6cc5593 100755 --- a/.config/zsh/autoload/git/git-https-and-ssh +++ b/.config/zsh/autoload/git/git-https-and-ssh @@ -9,12 +9,12 @@ remote="${1:-origin}" url="$($GIT remote get-url "$remote")" if [ "${url##https://}" = "$url" ]; then - https_url="https://${url##*@}" - https_url="${https_url%%:*}/${https_url#*:}" + https_url="${url##*@}" + https_url="https://${https_url/:/\/}" $GIT remote set-url "$remote" "$https_url" $GIT remote set-url --push "$remote" "$url" else - ssh_url="git@${url#https://}" - ssh_url="${ssh_url%%/*}:${ssh_url#*/}" + ssh_url="${url#https://}" + ssh_url="git@${ssh_url/\//:}" $GIT remote set-url --push "$remote" "$ssh_url" fi