Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Isolate Git context probes from inherited repository environment

Nohj62479ff9fce0
diff --git a/src/git/git_context.c b/src/git/git_context.c
index a63d3385e..6986be4aa 100644
--- a/src/git/git_context.c
+++ b/src/git/git_context.c
@@ -65,7 +65,9 @@ static int git_capture(const char *repo_path, const char *git_args, char **out)
return CBM_NOT_FOUND;
}
- FILE *fp = cbm_popen(cmd, "r");
+ /* A hook or editor may export GIT_DIR/GIT_WORK_TREE for another repo.
+ * Isolate this child so git -C selects repo_path rather than that repo. */
+ FILE *fp = cbm_popen_git(cmd);
if (!fp) {
return CBM_NOT_FOUND;
}