(rootDir: string)
| 268 | * once HEAD diverges, leaving releases with no changelog body. |
| 269 | */ |
| 270 | export function recoverDeletedBumpFiles(rootDir: string): BumpFile[] { |
| 271 | // The most recent commit that deleted any .bumpy/*.md file — i.e. the version |
| 272 | // commit that consumed them. |
| 273 | const versionCommit = tryRunArgs(['git', 'log', '--diff-filter=D', '--format=%H', '-n', '1', '--', '.bumpy/*.md'], { |
| 274 | cwd: rootDir, |
| 275 | }) |
| 276 | ?.split('\n') |
| 277 | .filter(Boolean)[0] |
| 278 | ?.trim(); |
| 279 | if (!versionCommit) return []; |
| 280 | |
| 281 | // Read the deleted files' content from the commit's parent. |
| 282 | const parent = `${versionCommit}~1`; |
| 283 | const deleted = tryRunArgs( |
| 284 | ['git', 'diff', '--diff-filter=D', '--name-only', parent, versionCommit, '--', '.bumpy/*.md'], |
| 285 | { cwd: rootDir }, |
| 286 | ); |
| 287 | if (!deleted) return []; |
| 288 | |
| 289 | const bumpFiles: BumpFile[] = []; |
| 290 | for (const filePath of deleted.split('\n').filter(Boolean)) { |
| 291 | if (filePath.endsWith('README.md')) continue; |
| 292 | const content = tryRunArgs(['git', 'show', `${parent}:${filePath}`], { cwd: rootDir }); |
| 293 | if (!content) continue; |
| 294 | const { bumpFile } = parseBumpFile(content, fileToId(filePath)); |
| 295 | if (bumpFile) bumpFiles.push(bumpFile); |
| 296 | } |
| 297 | return bumpFiles; |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Move bump files into a channel's shipped directory (`.bumpy/<channel>/`). |
no test coverage detected
searching dependent graphs…