MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / make_git_repo

Function make_git_repo

tests/test_git_context.c:49–61  ·  view source on GitHub ↗

Create a minimal git repo at dir (init + empty commit so HEAD exists). */

Source from the content-addressed store, hash-verified

47
48/* Create a minimal git repo at dir (init + empty commit so HEAD exists). */
49static int make_git_repo(const char *dir) {
50 if (th_mkdir_p(dir) != 0) return -1;
51 if (git_run(dir, "init -q") != 0) return -1;
52 if (git_run(dir, "config user.email test@example.com") != 0) return -1;
53 if (git_run(dir, "config user.name Test") != 0) return -1;
54 /* Create a file so HEAD points to a real commit. */
55 char path[1024];
56 snprintf(path, sizeof(path), "%s/.keep", dir);
57 th_write_file(path, "");
58 if (git_run(dir, "add .keep") != 0) return -1;
59 if (git_run(dir, "commit -q -m init") != 0) return -1;
60 return 0;
61}
62#endif /* _WIN32 */
63
64/* ── canonical_root: normal repo indexed from its root ──────────── */

Callers 1

test_git_context.cFile · 0.85

Calls 3

th_mkdir_pFunction · 0.85
git_runFunction · 0.85
th_write_fileFunction · 0.85

Tested by

no test coverage detected