MCPcopy Index your code
hub / github.com/Waishnav/devspace / createWorkingTreeSnapshot

Function createWorkingTreeSnapshot

src/review-checkpoints.ts:122–136  ·  view source on GitHub ↗
(gitRoot: string)

Source from the content-addressed store, hash-verified

120}
121
122async function createWorkingTreeSnapshot(gitRoot: string): Promise<string> {
123 const tempDir = await mkdtemp(join(tmpdir(), "devspace-review-index-"));
124 const indexPath = join(tempDir, "index");
125 const env = checkpointEnv(indexPath);
126
127 try {
128 await git(gitRoot, ["read-tree", "HEAD"], { env });
129 await git(gitRoot, ["add", "-A", "--", "."], { env });
130 const tree = (await git(gitRoot, ["write-tree"], { env })).stdout.trim();
131 const parent = (await git(gitRoot, ["rev-parse", "--verify", "HEAD^{commit}"])).stdout.trim();
132 return (await git(gitRoot, ["commit-tree", tree, "-p", parent, "-m", "DevSpace review snapshot"], { env })).stdout.trim();
133 } finally {
134 await rm(tempDir, { recursive: true, force: true });
135 }
136}
137
138function checkpointEnv(indexPath: string): NodeJS.ProcessEnv {
139 return {

Callers 2

initializeWorkspaceFunction · 0.85
reviewChangesFunction · 0.85

Calls 2

checkpointEnvFunction · 0.85
gitFunction · 0.70

Tested by

no test coverage detected