Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/utils/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ export async function getRepoRoot(): Promise<string> {
return stdout.trim();
}

export async function getCurrentBranch(): Promise<string> {
const { stdout } = await exec("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
return stdout.trim();
}

export async function createWorktree(id: number): Promise<string> {
const repoRoot = await getRepoRoot();
const dir = await mkdtemp(join(tmpdir(), `thinktank-agent-${id}-`));
Expand Down Expand Up @@ -85,21 +80,6 @@ export async function getDiffStats(
}
}

export async function applyDiff(diff: string, targetDir: string): Promise<void> {
const { execFile: execFileCb } = await import("node:child_process");
const child = execFileCb("git", ["apply", "--3way", "-"], {
cwd: targetDir,
});
child.stdin?.write(diff);
child.stdin?.end();
await new Promise<void>((resolve, reject) => {
child.on("close", (code) => {
if (code === 0) resolve();
else reject(new Error(`git apply failed with code ${code}`));
});
});
}

export async function cleanupBranches(): Promise<void> {
const repoRoot = await getRepoRoot();
const { stdout } = await exec("git", ["branch", "--list", "thinktank/*"], {
Expand Down
Loading