(branch: string)
| 85 | * Merges local entries with whatever is on disk (which may have been updated by git pull). |
| 86 | */ |
| 87 | export async function syncBranchContext(branch: string): Promise<ContextEntry[]> { |
| 88 | const dir = await getDevCtxDir(); |
| 89 | const branchFile = path.join(dir, "branches", `${branch.replace(/\//g, "__")}.json`); |
| 90 | |
| 91 | if (!fs.existsSync(branchFile)) return []; |
| 92 | |
| 93 | const diskEntries: ContextEntry[] = JSON.parse(fs.readFileSync(branchFile, "utf-8")); |
| 94 | |
| 95 | // Deduplicate (in case of merge conflicts resolved by git) |
| 96 | const deduped = mergeContexts([], diskEntries); |
| 97 | fs.writeFileSync(branchFile, JSON.stringify(deduped, null, 2)); |
| 98 | |
| 99 | return deduped; |
| 100 | } |
| 101 |
nothing calls this directly
no test coverage detected