MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _run_git

Function _run_git

src/utils/git.py:14–34  ·  view source on GitHub ↗
(
    args: list[str],
    cwd: str | None = None,
    timeout: float = 30.0,
)

Source from the content-addressed store, hash-verified

12
13
14def _run_git(
15 args: list[str],
16 cwd: str | None = None,
17 timeout: float = 30.0,
18) -> tuple[str, str, int]:
19 effective_cwd = cwd or os.getcwd()
20 try:
21 result = subprocess.run(
22 ["git", *args],
23 capture_output=True,
24 text=True,
25 cwd=effective_cwd,
26 timeout=timeout,
27 )
28 return result.stdout.strip(), result.stderr.strip(), result.returncode
29 except subprocess.TimeoutExpired:
30 return "", "Command timed out", -1
31 except FileNotFoundError:
32 return "", "git not found", -1
33 except Exception as e:
34 return "", str(e), -1
35
36
37def _run_git_ok(args: list[str], cwd: str | None = None) -> str:

Callers 6

test_run_git_failureMethod · 0.90
test_run_git_timeoutMethod · 0.90
_run_git_okFunction · 0.70
create_branchFunction · 0.70
create_worktreeFunction · 0.70
remove_worktreeFunction · 0.70

Calls 1

runMethod · 0.45

Tested by 2

test_run_git_failureMethod · 0.72
test_run_git_timeoutMethod · 0.72