Answer stability round 1: 1 🔴, 4 🟡 (0 misread); keep credentials out of questions, stop a clone that waits, ask where a file is in the way
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Which forge a checkout's origin is on, and running that forge's CLI in the checkout."""
|
||||
"""Which forge a checkout's origin is on, a repo's URL beside that origin's, and running the forge's CLI in the checkout."""
|
||||
import json
|
||||
import re
|
||||
import subprocess
|
||||
@@ -18,9 +18,9 @@ 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. The URL has no `.git`, since gh and tea clone without it."""
|
||||
"""The origin URL of the repo called name under the same 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`, which git clones without."""
|
||||
place = re.fullmatch(r"(.+[/:])[^/:]+", origin_url.rstrip("/"))
|
||||
# A scheme's own `//` leaves no repo to put a name beside.
|
||||
# An origin of only a scheme and a host, such as `https://host`, has no owner folder to put a name in.
|
||||
return place.group(1) + name if place and not place.group(1).endswith("//") else None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user