MCPcopy Create free account
hub / github.com/tirth8205/code-review-graph / _has_git_changes

Function _has_git_changes

code_review_graph/tools/context.py:16–34  ·  view source on GitHub ↗

Quick check for uncommitted or diffed changes.

(root: Path, base: str)

Source from the content-addressed store, hash-verified

14
15
16def _has_git_changes(root: Path, base: str) -> bool:
17 """Quick check for uncommitted or diffed changes."""
18 try:
19 result = subprocess.run(
20 ["git", "diff", "--name-only", base, "--"],
21 capture_output=True, stdin=subprocess.DEVNULL, text=True,
22 cwd=str(root), timeout=10,
23 )
24 if result.returncode == 0 and result.stdout.strip():
25 return True
26 # Also check staged/unstaged
27 result2 = subprocess.run(
28 ["git", "status", "--porcelain"],
29 capture_output=True, stdin=subprocess.DEVNULL, text=True,
30 cwd=str(root), timeout=10,
31 )
32 return bool(result2.stdout.strip())
33 except (FileNotFoundError, subprocess.TimeoutExpired):
34 return False
35
36
37def get_minimal_context(

Callers 1

get_minimal_contextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected