(args: list[str])
| 1929 | from opentrace_agent.sources.code.git_cloner import _clean_env |
| 1930 | |
| 1931 | def _run(args: list[str]) -> tuple[int, str]: |
| 1932 | try: |
| 1933 | proc = subprocess.run( |
| 1934 | ["git", "-C", str(clone_dir), *args], |
| 1935 | capture_output=True, |
| 1936 | text=True, |
| 1937 | timeout=60, |
| 1938 | env=_clean_env(), |
| 1939 | ) |
| 1940 | except subprocess.TimeoutExpired: |
| 1941 | return 124, "git command timed out after 60s" |
| 1942 | except Exception as e: |
| 1943 | return 1, _scrub_token(str(e)) |
| 1944 | msg = (proc.stderr or proc.stdout or "").strip() |
| 1945 | return proc.returncode, _scrub_token(msg) |
| 1946 | |
| 1947 | if ref: |
| 1948 | rc, msg = _run(["fetch", "--depth=1", "origin", ref]) |
no test coverage detected