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

Function make_git_repo

tests/test_git_context.c:75–87  ·  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

73
74/* Create a minimal git repo at dir (init + empty commit so HEAD exists). */
75static int make_git_repo(const char *dir) {
76 if (th_mkdir_p(dir) != 0) return -1;
77 if (git_run(dir, "init -q") != 0) return -1;
78 if (git_run(dir, "config user.email test@example.com") != 0) return -1;
79 if (git_run(dir, "config user.name Test") != 0) return -1;
80 /* Create a file so HEAD points to a real commit. */
81 char path[1024];
82 snprintf(path, sizeof(path), "%s/.keep", dir);
83 th_write_file(path, "");
84 if (git_run(dir, "add .keep") != 0) return -1;
85 if (git_run(dir, "commit -q -m init") != 0) return -1;
86 return 0;
87}
88#endif /* _WIN32 */
89
90#ifndef _WIN32

Callers 2

make_env_isolation_treeFunction · 0.85
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