Skip to content

Commit 8335451

Browse files
authored
Update git_utils.py
1 parent 0a9d523 commit 8335451

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

codeflash/code_utils/git_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ def get_git_remotes(repo: Repo) -> list[str]:
8282
def get_repo_owner_and_name(repo: Repo | None = None, git_remote: str | None = "origin") -> tuple[str, str]:
8383
remote_url = get_remote_url(repo, git_remote) # call only once
8484
remote_url = remote_url.removesuffix(".git") if remote_url.endswith(".git") else remote_url
85+
remote_url = remote_url.rstrip("/")
8586
split_url = remote_url.split("/")
86-
if split_url[-1] == "":
87-
repo_owner_with_github, repo_name = split_url[-3], split_url[-2]
88-
else:
89-
repo_owner_with_github, repo_name = split_url[-2], split_url[-1]
87+
repo_owner_with_github, repo_name = split_url[-2], split_url[-1]
9088
repo_owner = repo_owner_with_github.split(":")[1] if ":" in repo_owner_with_github else repo_owner_with_github
9189
return repo_owner, repo_name
9290

0 commit comments

Comments
 (0)