MCPcopy Index your code
hub / github.com/openai/plugins / git_submodule_entries

Function git_submodule_entries

plugins/codex-security/scripts/workbench_target.py:182–199  ·  view source on GitHub ↗
(target: Path)

Source from the content-addressed store, hash-verified

180
181
182def git_submodule_entries(target: Path) -> tuple[tuple[Path, str], ...]:
183 repository, pathspec = git_worktree_context(target)
184 staged = git_bytes(repository, "ls-files", "--stage", "-z", "--", pathspec)
185 if staged is None:
186 raise SystemExit("Could not inspect Git submodules in the selected working tree.")
187 entries = []
188 for record in (item for item in staged.split(b"\0") if item):
189 try:
190 metadata, raw_path = record.split(b"\t", 1)
191 mode, object_id, _ = metadata.split(b" ", 2)
192 except ValueError as exc:
193 raise SystemExit(
194 "Could not inspect Git submodules in the selected working tree."
195 ) from exc
196 if mode != b"160000":
197 continue
198 entries.append((repository / os.fsdecode(raw_path), object_id.decode("ascii")))
199 return tuple(entries)
200
201
202def git_submodule_paths(target: Path) -> tuple[Path, ...]:

Callers 2

git_submodule_pathsFunction · 0.85

Calls 2

git_worktree_contextFunction · 0.85
git_bytesFunction · 0.85

Tested by

no test coverage detected