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

Function is_git_repo

src/watcher/watcher.c:118–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116#endif
117
118static bool is_git_repo(const char *root_path) {
119 char cmd[CBM_SZ_1K];
120 snprintf(cmd, sizeof(cmd), "git -C \"%s\" rev-parse --git-dir 2>%s", root_path, WATCHER_NULDEV);
121 FILE *fp = cbm_popen(cmd, "r");
122 if (!fp) {
123 return false;
124 }
125 /* Drain output so pclose gets a clean exit status. */
126 char drain[CBM_SZ_128];
127 while (fgets(drain, (int)sizeof(drain), fp)) { /* discard */
128 }
129 int rc = cbm_pclose(fp);
130 return rc == 0;
131}
132
133static int git_head(const char *root_path, char *out, size_t out_size) {
134 char cmd[CBM_SZ_1K];

Callers 1

init_baselineFunction · 0.85

Calls 2

cbm_popenFunction · 0.85
cbm_pcloseFunction · 0.85

Tested by

no test coverage detected