MCPcopy
hub / github.com/openai/codex-plugin-cc / ensureGitRepository

Function ensureGitRepository

plugins/codex/scripts/lib/git.mjs:77–87  ·  view source on GitHub ↗
(cwd)

Source from the content-addressed store, hash-verified

75}
76
77export function ensureGitRepository(cwd) {
78 const result = git(cwd, ["rev-parse", "--show-toplevel"]);
79 const errorCode = result.error && "code" in result.error ? result.error.code : null;
80 if (errorCode === "ENOENT") {
81 throw new Error("git is not installed. Install Git and retry.");
82 }
83 if (result.status !== 0) {
84 throw new Error("This command must run inside a Git repository.");
85 }
86 return result.stdout.trim();
87}
88
89export function getRepoRoot(cwd) {
90 return gitChecked(cwd, ["rev-parse", "--show-toplevel"]).stdout.trim();

Callers 3

executeReviewRunFunction · 0.90
resolveWorkspaceRootFunction · 0.90
resolveReviewTargetFunction · 0.85

Calls 1

gitFunction · 0.85

Tested by

no test coverage detected