Kill the surviving mutants of repos.py and url_beside

This commit is contained in:
2026-11-18 13:06:55 +01:00
parent 3de693f1a5
commit 2776d1694d
4 changed files with 13 additions and 13 deletions
+4 -5
View File
@@ -18,11 +18,10 @@ def forge_of(origin_url: str) -> Forge:
def url_beside(origin_url: str, name: str) -> str | None:
"""The origin URL of the repo called name in the same place, host and owner, as origin_url's repo; None where origin_url has no place, such as a bare name. A trailing `.git` is dropped, since gh and tea clone without it."""
trimmed = origin_url.rstrip("/").removesuffix(".git")
place = re.fullmatch(r"(.+[/:])[^/:]+", trimmed)
# A scheme's own `//` or `:` leaves no repo to put a name beside.
return place.group(1) + name if place and not place.group(1).endswith("//") and not re.fullmatch(r"\w+:", place.group(1)) else None
"""The origin URL of the repo called name in the same place, host and owner, as origin_url's repo; None where origin_url has no place, such as a bare name. The URL has no `.git`, since gh and tea clone without it."""
place = re.fullmatch(r"(.+[/:])[^/:]+", origin_url.rstrip("/"))
# A scheme's own `//` leaves no repo to put a name beside.
return place.group(1) + name if place and not place.group(1).endswith("//") else None
def runner(cwd: str) -> Run: