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
18 changes: 13 additions & 5 deletions gitgalaxy/galaxyscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,10 @@ def __init__(
self.version = version
self.temp_dir: Optional[str] = None
self.root = self._prepare_target(target_input)
self.single_file_target = None
if self.root.is_file():
self.single_file_target = self.root.name
self.root = self.root.parent

lang_defs = config.get("LANGUAGE_DEFINITIONS", {})
aperture_cfg = config.get("APERTURE_CONFIG", {})
Expand Down Expand Up @@ -1416,11 +1420,15 @@ def execute_pipeline(self, output_file: str = "galaxy.json"):
def _build_file_census(self):
"""Phase 0: Building the Census via Git Authority with Fallback."""
try:
raw_output = subprocess.check_output( # noqa: S603 -- _GIT_BIN resolved absolute, args are fixed strings
[_GIT_BIN, "ls-files"], cwd=self.root, text=True, stderr=subprocess.DEVNULL
)
git_paths = raw_output.splitlines()
self.git_tracked_files = set(git_paths)
if getattr(self, "single_file_target", None):
git_paths = [self.single_file_target]
self.git_tracked_files = set(git_paths)
else:
raw_output = subprocess.check_output( # noqa: S603 -- _GIT_BIN resolved absolute, args are fixed strings
[_GIT_BIN, "ls-files"], cwd=self.root, text=True, stderr=subprocess.DEVNULL
)
git_paths = raw_output.splitlines()
self.git_tracked_files = set(git_paths)

# --- FAST I/O: ThreadPool for os.stat operations ---
def _inspect_path(rel_path):
Expand Down
Loading