Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dagshub/common/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def init(
repo, branch = determine_repo(root)
url = repo.repo_url

url = url.rstrip("/")
if url.endswith(".git"):
url = url[:-4]
# Extract the owner and name from the repo_url
Expand Down
9 changes: 9 additions & 0 deletions tests/common/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ def test_init_creates_repo_under_current_user_from_url(
)


def test_init_from_url_ignores_trailing_slash(
mock_repo_api, mock_user_api, mock_create_repo, mock_get_token, mock_log_message
):
dagshub.init(url="https://dagshub.com/testuser/my-repo/", mlflow=False, dvc=False)

mock_repo_api.assert_called_once_with("testuser/my-repo", host="https://dagshub.com")
mock_create_repo.assert_called_once_with("my-repo", host="https://dagshub.com")


def test_init_creates_repo_under_org_from_url(
mock_repo_api, mock_user_api, mock_create_repo, mock_get_token, mock_log_message
):
Expand Down