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

Function git_has_own_dot_git

src/watcher/watcher.c:525–533  ·  view source on GitHub ↗

True when root_path carries its OWN repository marker: a `.git` directory, or * a `.git` file (the gitlink form used by linked worktrees and initialized * submodules). Deliberately a filesystem check, not a git invocation — the whole * point is to learn something `rev-parse` cannot tell us, because it walks up. */

Source from the content-addressed store, hash-verified

523 * submodules). Deliberately a filesystem check, not a git invocation — the whole
524 * point is to learn something `rev-parse` cannot tell us, because it walks up. */
525static bool git_has_own_dot_git(const char *root_path) {
526 char path[CBM_SZ_4K];
527 int written = snprintf(path, sizeof(path), "%s/.git", root_path);
528 if (written <= 0 || (size_t)written >= sizeof(path)) {
529 return false;
530 }
531 struct stat st;
532 return stat(path, &st) == 0 && (S_ISDIR(st.st_mode) || S_ISREG(st.st_mode));
533}
534
535/* Does the ancestor repository actually track anything inside this directory?
536 * Emptiness distinguishes "a scratch folder that merely sits under a repo" from

Callers 1

init_baselineFunction · 0.85

Calls 1

statClass · 0.70

Tested by

no test coverage detected