Fix GitLab and Bitbucket URLs
Remove GitLab and Bitbucket URLs when getting the user and repo name.
This commit is contained in:
parent
d26ecee2ee
commit
a57d60e1b4
|
@ -11,10 +11,15 @@
|
|||
clone() {
|
||||
repo_url="$1"
|
||||
|
||||
# TODO: work with Bitbucket and GitLab.
|
||||
# TODO: make it work with multi-level URLS - e.g. https://gitlab.com/a/b/c/d.git
|
||||
|
||||
user_and_repo_name="''${repo_url#https://github.com/}"
|
||||
user_and_repo_name="''${repo_url#git@github.com:}"
|
||||
user_and_repo_name="''${repo_url}"
|
||||
user_and_repo_name="''${user_and_repo_name#git@bitbucket.com:}"
|
||||
user_and_repo_name="''${user_and_repo_name#git@github.com:}"
|
||||
user_and_repo_name="''${user_and_repo_name#git@gitlab.com:}"
|
||||
user_and_repo_name="''${user_and_repo_name#https://bitbucket.com/}"
|
||||
user_and_repo_name="''${user_and_repo_name#https://github.com/}"
|
||||
user_and_repo_name="''${user_and_repo_name#https://gitlab.com/}"
|
||||
|
||||
if [[ "''${user_and_repo_name}" =~ / ]]; then
|
||||
user="''${user_and_repo_name%%/*}"
|
||||
|
|
Loading…
Reference in a new issue