fix: repair dev modules and scoped release git trust
This commit is contained in:
@@ -164,9 +164,10 @@ def git_success(path: Path, *args: str, timeout: int = 10) -> bool:
|
||||
|
||||
|
||||
def git(path: Path, *args: str, timeout: int = 10) -> subprocess.CompletedProcess[str]:
|
||||
command = scoped_git_command(path, *args)
|
||||
try:
|
||||
return subprocess.run(
|
||||
["/usr/bin/git", "-c", "core.hooksPath=/dev/null", *args],
|
||||
command,
|
||||
cwd=path,
|
||||
check=False,
|
||||
text=True,
|
||||
@@ -176,7 +177,20 @@ def git(path: Path, *args: str, timeout: int = 10) -> subprocess.CompletedProces
|
||||
env=sanitized_git_environment(),
|
||||
)
|
||||
except subprocess.TimeoutExpired as exc:
|
||||
return subprocess.CompletedProcess(["/usr/bin/git", *args], 124, exc.stdout or "", exc.stderr or "git command timed out")
|
||||
return subprocess.CompletedProcess(command, 124, exc.stdout or "", exc.stderr or "git command timed out")
|
||||
|
||||
|
||||
def scoped_git_command(path: Path, *args: str) -> tuple[str, ...]:
|
||||
"""Trust exactly one resolved catalog checkout for one Git invocation."""
|
||||
|
||||
return (
|
||||
"/usr/bin/git",
|
||||
"-c",
|
||||
"core.hooksPath=/dev/null",
|
||||
"-c",
|
||||
f"safe.directory={path.resolve()}",
|
||||
*args,
|
||||
)
|
||||
|
||||
|
||||
def sanitized_git_environment(
|
||||
|
||||
Reference in New Issue
Block a user