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.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Merge pull request #542 from mvanhorn/fix/499-global-core-excludesfile-ignore-source
Martin Vogel090a1a72d56b
diff --cc src/discover/discover.cindex b13130e8b,c37a0212c..fc7c7f0f5--- a/src/discover/discover.c+++ b/src/discover/discover.c@@@ -552,26 -768,20 +774,35 @@@ int cbm_discover_ex(const char *repo_pachar gi_path[CBM_SZ_4K];snprintf(gi_path, sizeof(gi_path), "%s/.git", repo_path);struct stat gi_stat;- if (wide_stat(gi_path, &gi_stat) == 0 && S_ISDIR(gi_stat.st_mode)) {+ bool is_git_repo = wide_stat(gi_path, &gi_stat) == 0 && S_ISDIR(gi_stat.st_mode);+ bool has_git_config = false;+ if (is_git_repo) {+ snprintf(gi_path, sizeof(gi_path), "%s/.git/config", repo_path);+ has_git_config = wide_stat(gi_path, &gi_stat) == 0 && S_ISREG(gi_stat.st_mode);snprintf(gi_path, sizeof(gi_path), "%s/.gitignore", repo_path);gitignore = cbm_gitignore_load(gi_path);++ char exc_path[CBM_SZ_4K];+ snprintf(exc_path, sizeof(exc_path), "%s/.git/info/exclude", repo_path);+ cbm_gitignore_t *git_exclude = cbm_gitignore_load(exc_path);+ if (git_exclude) {+ if (!gitignore) {+ gitignore = git_exclude;+ } else {+ /* On allocation failure the merge is atomic (dst unchanged), so+ * the .gitignore patterns still apply; the exclude patterns are+ * simply skipped — same as if .git/info/exclude were absent. */+ (void)cbm_gitignore_merge(gitignore, git_exclude);+ cbm_gitignore_free(git_exclude);+ }+ }}+ cbm_gitignore_t *global_gi = NULL;+ if (has_git_config && resolve_global_excludes_path(gi_path, sizeof(gi_path))) {+ global_gi = cbm_gitignore_load(gi_path);+ }+/* Load cbmignore if specified or exists at repo root */cbm_gitignore_t *cbmignore = NULL;if (opts && opts->ignore_file) {