diff options
| author | Claude <noreply@anthropic.com> | 2026-11-06 00:54:48 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-11-06 00:54:48 +0000 |
| commit | 7aba3deae3ff17d032c37e07d2929d1426b34278 (patch) | |
| tree | 9c482f9acda1599bd2f9bed95a6a46b75e634e80 /plugins/receipts | |
| parent | 5472f5f56e0070feeeb464318b316714fe3e9105 (diff) | |
| parent | b8331dd69ab3e132bbf8cd6e89b5d8c1747e21b1 (diff) | |
Merge remote-tracking branch 'origin/main' into add-plugin/xcodeadd-plugin/xcode
Diffstat (limited to 'plugins/receipts')
| -rw-r--r-- | plugins/receipts/skills/receipts/scripts/mine-transcripts.mjs | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/plugins/receipts/skills/receipts/scripts/mine-transcripts.mjs b/plugins/receipts/skills/receipts/scripts/mine-transcripts.mjs index 41439c35..43ab5547 100644 --- a/plugins/receipts/skills/receipts/scripts/mine-transcripts.mjs +++ b/plugins/receipts/skills/receipts/scripts/mine-transcripts.mjs @@ -897,13 +897,40 @@ let anyGitData = false; let anyGitError = false; for (const [name, agg] of Object.entries(byRepo)) { - const dir = [...agg.cwd][0]; - // Only ask git about projects that ARE git repos, and only about the files - // CC actually touched there. - const raw = dir ? gitCommitsWithOurWork(dir, agg.filesTouched) : null; - const gitFailed = raw === GIT_UNAVAILABLE; + const dirs = [...agg.cwd]; + // A project can be checked out in more than one local clone (sibling + // worktree-style trees cloned separately from the same remote), and they + // all land in the same bucket by directory basename. Query every clone + // that contributed to this bucket — not just one arbitrarily chosen one — + // and union the resulting commits by sha. Picking a single clone means a + // commit pushed from a sibling clone but never fetched here reads as a + // real "0 commits" instead of a git error, and a file only ever edited in + // a different clone than the one picked fails the toplevel-prefix pathspec + // check and silently drops out of the query entirely. + const byShaForRepo = new Map(); + let sawUsableClone = false; // some clone answered (repo, maybe zero matching commits) + let sawFailedClone = false; // some clone errored (couldn't tell, not "none") + for (const dir of dirs) { + const raw = gitCommitsWithOurWork(dir, agg.filesTouched); + if (raw === GIT_UNAVAILABLE) { + sawFailedClone = true; + } else if (raw !== null) { + // null means this clone wasn't applicable (no toplevel, no resolvable + // identity, or none of our files live under it) — not a usable answer, + // but not a failure either, so it doesn't set either flag. + sawUsableClone = true; + for (const c of raw) byShaForRepo.set(c.sha, c.date); + } + } + // A clone that errored may hold exactly the commits the others lack, so a + // zero alongside a failure is "couldn't tell", not "none". Commits found in + // a clone that answered still count: a broken sibling must not hide them. + const gitFailed = sawFailedClone && byShaForRepo.size === 0; if (gitFailed) anyGitError = true; - const commits = gitFailed ? null : raw; + const commits = + sawUsableClone && !gitFailed + ? [...byShaForRepo].map(([sha, date]) => ({ sha, date })) + : null; let gitActiveDayOverlap = null; if (commits) { @@ -924,7 +951,7 @@ for (const [name, agg] of Object.entries(byRepo)) { // null, not false, for the research bucket — it isn't a repo, but it isn't // a directory either, and `false` makes the renderer footnote it as "work // done in a plain directory", which is untrue of the biggest row on the page. - isRepo: name === NO_PROJECT ? null : !!(dir && gitToplevel(dir)), + isRepo: name === NO_PROJECT ? null : dirs.some((d) => !!gitToplevel(d)), commitsWithOurWork: commits ? commits.length : null, // True when git was asked and couldn't answer. Distinct from a null count // meaning "not a repo" or "nothing landed" — the renderer must not report |
