* Distinct `file\0name` pairs defined by the given files — the shape sync's * definition delta needs (CG-33). * * Deliberately NOT `getNodeNamesByFiles`: a bare name set is taken over the * WHOLE changed batch, so a name that moves between two files in one commit * (or exists in one c
(filePaths: string[])
| 5738 | * own fact, so the move is seen as one removal plus one addition. |
| 5739 | */ |
| 5740 | getNodeNamePairsByFiles(filePaths: string[]): Set<string> { |
| 5741 | const pairs = new Set<string>(); |
| 5742 | if (filePaths.length === 0) return pairs; |
| 5743 | for (let i = 0; i < filePaths.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 5744 | const chunk = filePaths.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 5745 | const placeholders = chunk.map(() => '?').join(','); |
| 5746 | const rows = this.db |
| 5747 | .prepare(`SELECT DISTINCT file_path, name FROM nodes WHERE file_path IN (${placeholders})`) |
| 5748 | .all(...chunk) as Array<{ file_path: string; name: string }>; |
| 5749 | // NUL-joined: a path or a symbol name can contain a space, never a NUL. |
| 5750 | for (const row of rows) pairs.add(`${row.file_path}\0${row.name}`); |
| 5751 | } |
| 5752 | return pairs; |
| 5753 | } |
| 5754 | |
| 5755 | /** |
| 5756 | * The `file\0statement` pairs of the `export … from` statements in |