mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-20 03:54:32 +01:00
feedback_inbox and app_errors guessed kuhyx/<folder> for a task's repo, which filed cleanup-plate under kuhyx/cleanup-plate (real: Sepci0/cleanup-plate) and showed phantom repos on the board. Both now read the GitHub owner/name from ~/src/<folder>'s origin remote (https or ssh forms) and fall back to the guess only when there is no checkout or its origin is not on GitHub. app-errors 0.1.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWZfgt44aEKxvGBJkwP
21 lines
690 B
Python
21 lines
690 B
Python
"""A real git checkout in a temp dir, built without kuhy's git config."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
|
|
GIT = shutil.which("git") or "git"
|
|
|
|
|
|
def make_checkout(path: Path, origin: str | None) -> Path:
|
|
"""Init a repo at ``path`` with remote ``origin`` (none when None)."""
|
|
env = {"PATH": os.environ["PATH"], "HOME": str(path.parent), "GIT_CONFIG_NOSYSTEM": "1"}
|
|
path.mkdir(parents=True)
|
|
subprocess.run([GIT, "init", "-q", str(path)], check=True, env=env)
|
|
if origin is not None:
|
|
subprocess.run([GIT, "-C", str(path), "remote", "add", "origin", origin], check=True, env=env)
|
|
return path
|