Skip to content

Commit

Permalink
updated git.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Nov 22, 2023
1 parent 02284b1 commit 39f8288
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,14 @@ git_to_azure_url(){

azure_to_git_url(){
local url="$1"
#url="${url/:v3\//:}"
url="${url/\/_git\//\/}"
# XXX: strip the middle component out from [email protected]:v3/harisekhon/GitHub/DevOps-Bash-tools
url="$(perl -pe 's/v3\/([\/:][^\/:]+)(\/[^\/]+)(\/[^\/]+)$/$1$3/' <<< "$url")"
url="${url/:v3\//:}"
#url="${url/\/_git\//\/}"
# XXX: strip the middle component out from Azure URLs that aren't found in other major Git providers like GitHub / GitLab / Bitbucket:
#
# [email protected]:v3/harisekhon/GitHub/DevOps-Bash-tools
# https://dev.azure.com/harisekhon/GitHub/_git/DevOps-Bash-tools
#
url="$(perl -pe 's/([\/:][^\/:]+)\/[^\/]+\/_git(\/[^\/]+)$/$1$2/' <<< "$url")"
echo "$url"
}

Expand Down

0 comments on commit 39f8288

Please sign in to comment.