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

Function autoindex_limit_write_fixture

tests/test_mcp.c:22787–22811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22785} autoindex_limit_probe_t;
22786
22787static bool autoindex_limit_write_fixture(const char *repodir,
22788 const autoindex_limit_probe_t *probe) {
22789 if (th_mkdir_p(repodir) != 0) {
22790 return false;
22791 }
22792 for (int i = 0; i < probe->files; i++) {
22793 char path[640];
22794 char body[96];
22795 snprintf(path, sizeof(path), "%s/f%d.py", repodir, i);
22796 snprintf(body, sizeof(body), "def f%d():\n return %d\n", i, i);
22797 if (th_write_file(path, body) != 0) {
22798 return false;
22799 }
22800 }
22801 if (probe->git_root) {
22802 char gitdir[640];
22803 char head[700];
22804 snprintf(gitdir, sizeof(gitdir), "%s/.git", repodir);
22805 snprintf(head, sizeof(head), "%s/HEAD", gitdir);
22806 if (th_mkdir_p(gitdir) != 0 || th_write_file(head, "ref: refs/heads/main\n") != 0) {
22807 return false;
22808 }
22809 }
22810 return true;
22811}
22812
22813/* Drive initialize → maybe_auto_index over a fresh root holding probe->files
22814 * indexable files under auto_index_limit=probe->limit. skip_out receives the

Callers 1

autoindex_limit_probeFunction · 0.85

Calls 2

th_mkdir_pFunction · 0.85
th_write_fileFunction · 0.85

Tested by

no test coverage detected