Repository navigation
Commit 30bad01
fix(core): read a commit's parents from the object, not the shallow graft
getCommitParents() read the parents with "git rev-list --parents", which honours
the shallow graft: on the shallow clones CI uses, every commit at the boundary
of the fetched history is reported as having no parent. That is exactly the
commit we ask about - the test-merge commit HEAD sits on - so the answer came
from a "git fetch --depth=2 origin <sha>" instead, once per build, over the
network, for a commit the remote has to still be willing to serve.
The commit object carries its parent SHAs whatever the graft says, so reading
the object answers locally and cannot fail on the network, on lock contention,
or on a remote that has stopped advertising the commit. Only the SHAs come back
this way - the parent objects can still be absent - which is all the one caller
needs, and is now written down.
With the fetch gone the function is synchronous, and the deepening path it
existed for is unreachable: getTestMergeBaseCommitSha only calls it after
establishing that the commit is HEAD, so its object is always present. An
explicit maxBuffer replaces the bound the old command got for free from
printing nothing but SHAs.
Reading the object and failing to read it are also reported apart now. Both used
to log "is not a merge commit", which blames the commit's shape for a commit we
never managed to look at.
The existing tests build a full local repository, where the parents are readable
whatever git is asked, so none of them covered the shallow checkout CI actually
uses. The new one does, with the remote pointed at a path that does not exist.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent b2a9a9d commit 30bad01
3 files changed
Lines changed: 60 additions & 65 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
| 329 | + | |
| 330 | + | |
334 | 331 | | |
335 | 332 | | |
336 | | - | |
337 | | - | |
| 333 | + | |
| 334 | + | |
338 | 335 | | |
339 | 336 | | |
340 | | - | |
341 | | - | |
| 337 | + | |
| 338 | + | |
342 | 339 | | |
343 | 340 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
351 | 347 | | |
352 | 348 | | |
353 | 349 | | |
| |||
360 | 356 | | |
361 | 357 | | |
362 | 358 | | |
| 359 | + | |
| 360 | + | |
363 | 361 | | |
364 | 362 | | |
365 | | - | |
366 | | - | |
367 | 363 | | |
368 | 364 | | |
369 | 365 | | |
370 | 366 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
| 367 | + | |
376 | 368 | | |
377 | 369 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
358 | | - | |
359 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
360 | 360 | | |
361 | | - | |
362 | | - | |
363 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
364 | 372 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
| 373 | + | |
373 | 374 | | |
374 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
375 | 390 | | |
376 | 391 | | |
377 | | - | |
| 392 | + | |
378 | 393 | | |
379 | 394 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | 395 | | |
404 | 396 | | |
405 | 397 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
351 | 362 | | |
352 | 363 | | |
353 | 364 | | |
354 | | - | |
| 365 | + | |
355 | 366 | | |
356 | 367 | | |
357 | 368 | | |
| |||
368 | 379 | | |
369 | 380 | | |
370 | 381 | | |
371 | | - | |
| 382 | + | |
372 | 383 | | |
373 | 384 | | |
374 | 385 | | |
| |||
0 commit comments