MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / git_candidate_files

Function git_candidate_files

scripts/update_license_headers.py:119–143  ·  view source on GitHub ↗

Return Git-tracked and unignored files, or None if Git is unavailable.

(root: Path)

Source from the content-addressed store, hash-verified

117
118
119def git_candidate_files(root: Path) -> list[Path] | None:
120 """Return Git-tracked and unignored files, or None if Git is unavailable."""
121 try:
122 result = subprocess.run(
123 [
124 "git",
125 "-C",
126 str(root),
127 "ls-files",
128 "-z",
129 "--cached",
130 "--others",
131 "--exclude-standard",
132 ],
133 check=True,
134 capture_output=True,
135 )
136 except (OSError, subprocess.CalledProcessError):
137 return None
138
139 files = []
140 for raw_path in result.stdout.split(b"\0"):
141 if raw_path:
142 files.append(Path(os.fsdecode(raw_path)))
143 return files
144
145
146def is_git_ignored(root: Path, rel: Path) -> bool:

Callers 1

discover_filesFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected