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

Function git_worktree_context

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

Source from the content-addressed store, hash-verified

168
169
170def git_worktree_context(target: Path) -> tuple[Path, str]:
171 root = git_output(target, "rev-parse", "--show-toplevel")
172 if root is None:
173 raise SystemExit("Could not inspect the selected Git working tree.")
174 repository = Path(root).resolve()
175 try:
176 relative = target.resolve().relative_to(repository)
177 except ValueError as exc:
178 raise SystemExit("Scan target must stay inside its Git working tree.") from exc
179 return repository, relative.as_posix() or "."
180
181
182def git_submodule_entries(target: Path) -> tuple[tuple[Path, str], ...]:

Callers 5

worktree_content_digestFunction · 0.85
git_submodule_entriesFunction · 0.85
copy_git_worktree_filesFunction · 0.85

Calls 1

git_outputFunction · 0.85

Tested by

no test coverage detected