Skip to content
Merged
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 codeflash/code_utils/git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def get_repo_owner_and_name(repo: Repo | None = None, git_remote: str | None = "
remote_url = get_remote_url(repo, git_remote) # call only once
remote_url = remote_url.removesuffix(".git") if remote_url.endswith(".git") else remote_url
# remote_url = get_remote_url(repo, git_remote).removesuffix(".git") if remote_url.endswith(".git") else remote_url
remote_url = remote_url.rstrip("/")
split_url = remote_url.split("/")
repo_owner_with_github, repo_name = split_url[-2], split_url[-1]
repo_owner = repo_owner_with_github.split(":")[1] if ":" in repo_owner_with_github else repo_owner_with_github
Expand Down
6 changes: 6 additions & 0 deletions tests/test_git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def test_test_get_repo_owner_and_name(self, mock_get_remote_url):
assert owner == "owner"
assert repo_name == "repo"

# Test with another GitHub SSH URL
mock_get_remote_url.return_value = "[email protected]:codeflash-ai/posthog/"
owner, repo_name = get_repo_owner_and_name()
assert owner == "codeflash-ai"
assert repo_name == "posthog"

@patch("codeflash.code_utils.git_utils.git.Repo")
def test_check_running_in_git_repo_in_git_repo(self, mock_repo):
mock_repo.return_value.git_dir = "/path/to/repo/.git"
Expand Down
Loading