Skip to content

Commit 5cb0506

Browse files
committed
fix: address remaining review comments (PR #1232)
- Add FileNotFoundError to get_git_info exception handling - Ensure repo_root is absolute in resolve_import_path - Fix misleading comment in stop_hook.py
1 parent 5777115 commit 5cb0506

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.github/hooks/scripts/stop_hook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ def has_uncommitted_changes(repo_root: Path) -> bool:
3535
"""Check if there are uncommitted changes."""
3636
code, output = run_command(["git", "status", "--porcelain"], repo_root)
3737
if code == 0 and output:
38-
# Filter out untracked files in certain directories
38+
# Ignore all untracked files (marked with ??) - only track staged/modified
3939
lines = [
4040
line
4141
for line in output.split("\n")
42-
if line.strip() and not line.strip().startswith("??") # Ignore untracked
42+
if line.strip() and not line.strip().startswith("??")
4343
]
4444
return len(lines) > 0
4545
return False

analysis/dependency_analysis.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ def resolve_import_path(
148148
) -> Optional[str]:
149149
"""Resolve a relative import path to a workspace-relative path."""
150150
from_dir = from_file.parent
151+
# Ensure repo_root is absolute for reliable relative_to() calls
152+
repo_root = repo_root.resolve()
151153

152154
# Handle the import path
153155
# Remove ./ or ../ prefixes and resolve

analysis/snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def get_git_info(repo_root: pathlib.Path) -> dict:
7272
"branch": branch,
7373
"message": message[:200], # Truncate long messages
7474
}
75-
except (subprocess.CalledProcessError, subprocess.TimeoutExpired):
75+
except (subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError):
7676
return {
7777
"sha": "unknown",
7878
"short_sha": "unknown",

0 commit comments

Comments
 (0)