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:464–472  ·  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

462 * submodules). Deliberately a filesystem check, not a git invocation — the whole
463 * point is to learn something `rev-parse` cannot tell us, because it walks up. */
464static bool git_has_own_dot_git(const char *root_path) {
465 char path[CBM_SZ_4K];
466 int written = snprintf(path, sizeof(path), "%s/.git", root_path);
467 if (written <= 0 || (size_t)written >= sizeof(path)) {
468 return false;
469 }
470 struct stat st;
471 return stat(path, &st) == 0 && (S_ISDIR(st.st_mode) || S_ISREG(st.st_mode));
472}
473
474/* Does the ancestor repository actually track anything inside this directory?
475 * 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