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.

Use sparse checkout on CI to halve incremental test time

Martin Vogel7f8359316ce9
diff --git a/tests/test_incremental.c b/tests/test_incremental.c
index 735dbab63..fea2487a4 100644
--- a/tests/test_incremental.c
+++ b/tests/test_incremental.c
@@ -202,11 +202,21 @@ static int incremental_setup(void) {
snprintf(g_repodir, sizeof(g_repodir), "%s/fastapi", g_tmpdir);
- char cmd[512];
- snprintf(cmd, sizeof(cmd),
- "git clone --depth=1 --branch 0.99.1 --quiet "
- "https://github.com/fastapi/fastapi.git '%s' 2>&1",
- g_repodir);
+ /* On CI, use sparse checkout to skip docs/ and tests/ (~62% of files).
+ * Cuts indexing time roughly in half on slow shared runners. */
+ char cmd[1024];
+ if (getenv("CI")) {
+ snprintf(cmd, sizeof(cmd),
+ "git clone --depth=1 --branch 0.99.1 --quiet --filter=blob:none "
+ "--sparse https://github.com/fastapi/fastapi.git '%s' 2>&1 && "
+ "cd '%s' && git sparse-checkout set --no-cone '/*' '!/docs' '!/tests' 2>&1",
+ g_repodir, g_repodir);
+ } else {
+ snprintf(cmd, sizeof(cmd),
+ "git clone --depth=1 --branch 0.99.1 --quiet "
+ "https://github.com/fastapi/fastapi.git '%s' 2>&1",
+ g_repodir);
+ }
int rc = system(cmd);
if (rc != 0) {
printf(" clone failed (rc=%d) — network offline?\n", rc);