* Index `cg`'s project again from an empty database, as `codegraph index` * does, and return the new handle: the graph a synced index has to match. * indexAll over the synced index is no stand-in — it skips every file whose * content is unchanged, so the edges the sync wrote survive it untouched.
(cg: CodeGraph)
| 22 | * content is unchanged, so the edges the sync wrote survive it untouched. |
| 23 | */ |
| 24 | async function reindexFromScratch(cg: CodeGraph): Promise<CodeGraph> { |
| 25 | const root = cg.getProjectRoot(); |
| 26 | // recreate unlinks the database file; a held handle makes that EBUSY on Windows. |
| 27 | cg.close(); |
| 28 | const rebuilt = await CodeGraph.recreate(root); |
| 29 | await rebuilt.indexAll(); |
| 30 | return rebuilt; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * For a test that indexes twice in its body: on a busy host the default 5s |
no test coverage detected