MCPcopy
hub / github.com/coder/mux / initGitRepo

Function initGitRepo

src/node/runtime/submoduleSync.test.ts:15–30  ·  view source on GitHub ↗
(repoPath: string, files: Record<string, string>)

Source from the content-addressed store, hash-verified

13}
14
15async function initGitRepo(repoPath: string, files: Record<string, string>): Promise<void> {
16 await fs.mkdir(repoPath, { recursive: true });
17 git(repoPath, ["init", "-b", "main"]);
18 git(repoPath, ["config", "user.email", "test@example.com"]);
19 git(repoPath, ["config", "user.name", "test"]);
20 git(repoPath, ["config", "commit.gpgsign", "false"]);
21
22 for (const [relativePath, content] of Object.entries(files)) {
23 const absolutePath = path.join(repoPath, relativePath);
24 await fs.mkdir(path.dirname(absolutePath), { recursive: true });
25 await fs.writeFile(absolutePath, content, "utf-8");
26 }
27
28 git(repoPath, ["add", "."]);
29 git(repoPath, ["commit", "-m", "init"]);
30}
31
32function createInitLogger() {
33 const steps: string[] = [];

Callers 1

Calls 2

gitFunction · 0.85
writeFileMethod · 0.65

Tested by

no test coverage detected