fix: strip .git suffix when parsing github repo url (#1442)

_parse_gh_repo_url left a trailing .git on the repo name, so a clone
URL like https://github.com/SWE-agent/SWE-agent.git produced
repo_name SWE-agent__SWE-agent.git, polluting instance ids and output
dir names. Strip it off the repo group and extend the test.
This commit is contained in:
Anas Khan
2026-07-01 21:10:12 +05:30
committed by GitHub
parent d336402e7f
commit 5f40e63360
2 changed files with 4 additions and 3 deletions
+2 -3
View File
@@ -82,9 +82,8 @@ def _parse_gh_repo_url(repo_url: str) -> tuple[str, str]:
if not match:
msg = f"Invalid GitHub issue URL: {repo_url}"
raise InvalidGithubURL(msg)
res = match.groups()
assert len(res) == 2
return tuple(res) # type: ignore
owner, repo = match.groups()
return owner, repo.removesuffix(".git")
def _get_gh_issue_data(issue_url: str, *, token: str = ""):
+2
View File
@@ -39,6 +39,8 @@ def test_parse_gh_repo_url():
assert _parse_gh_repo_url("github.com/SWE-agent/SWE-agent") == ("SWE-agent", "SWE-agent")
assert _parse_gh_repo_url("github.com/SWE-agent/SWE-agent/asdfjsdfg") == ("SWE-agent", "SWE-agent")
assert _parse_gh_repo_url("git@github.com/SWE-agent/SWE-agent/asdfjsdfg") == ("SWE-agent", "SWE-agent")
assert _parse_gh_repo_url("https://github.com/SWE-agent/SWE-agent.git") == ("SWE-agent", "SWE-agent")
assert _parse_gh_repo_url("github.com/SWE-agent/SWE-agent.git") == ("SWE-agent", "SWE-agent")
def test_parse_gh_repo_url_fails():