Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/ledgermind/core/stores/semantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import uuid
import threading
import subprocess
import shutil
from datetime import datetime
from typing import List, Optional, Any, Dict, Tuple
from contextlib import contextmanager, nullcontext
Expand Down Expand Up @@ -88,8 +89,10 @@ def __init__(self, repo_path: str, trust_boundary: TrustBoundary = TrustBoundary

git_available = False
try:
subprocess.run(["git", "--version"], capture_output=True, check=True) # nosec B603 B607
git_available = True
git_path = shutil.which("git")
if git_path:
subprocess.run([git_path, "--version"], capture_output=True, check=True) # nosec B603 B607
git_available = True
except (subprocess.CalledProcessError, FileNotFoundError):
pass

Expand Down Expand Up @@ -130,7 +133,9 @@ def reconcile_untracked(self):
recovered = False
for f in disk_files:
if isinstance(self.audit, GitAuditProvider):
res = subprocess.run(["git", "ls-files", "--error-unmatch", f],
git_path = shutil.which("git")
if not git_path: continue
res = subprocess.run([git_path, "ls-files", "--error-unmatch", f],
cwd=self.repo_path, capture_output=True) # nosec B603 B607
if res.returncode != 0:
logger.info(f"Recovering untracked file: {f}")
Expand Down
Loading