Commit fcae2db
committed
fix(github-code-review): remove --3way from git apply strategies, fix resetCheckoutToCleanState
Root cause: gh repo clone creates refs and index files but the actual .pack
data can be incomplete/missing, leaving the git object store with missing
commit objects. This causes "bad object HEAD" errors and prevents git apply
--3way from working (--3way needs base commit objects for 3-way merge).
Changes:
applyPRDiff strategy order (simplified):
- git apply --whitespace=nowarn ← first choice (no --3way needed,
base files exist because we
cloned the base branch)
- git apply --whitespace=fix
- git apply --whitespace=nowarn --ignore-whitespace
- git apply --binary --whitespace=nowarn ← for binary file changes
- patch -p1 --no-backup-if-mismatch ← last resort, most lenient
Removed:
- patch --dry-run → patch two-step (dry-run succeeds but hunks are
ignored in incomplete clones, making dry-run unreliable)
- All --3way flags (requires base commit objects in object store)
resetCheckoutToCleanState:
- Changed from "git reset --hard HEAD && git checkout" to
"git checkout -f" which does NOT require HEAD commit object to exist
in object store — prevents "bad object HEAD" failures in incomplete
clones.
Also cleaned broken checkout at /tmp/pr-checkouts/interserver/my/158
(which had missing .pack file) to force fresh clone on next run.
Verification:
- php -l: no errors
- PHPStan level 8: 0 errors
- Worker tests: 75/75 pass
- CLI tests: 232/232 pass1 parent 23bb204 commit fcae2db
1 file changed
Lines changed: 18 additions & 56 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | | - | |
| 481 | + | |
483 | 482 | | |
484 | | - | |
| 483 | + | |
| 484 | + | |
485 | 485 | | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
| 486 | + | |
492 | 487 | | |
493 | 488 | | |
494 | 489 | | |
495 | 490 | | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
| 491 | + | |
502 | 492 | | |
503 | 493 | | |
504 | 494 | | |
505 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | 511 | | |
552 | 512 | | |
553 | 513 | | |
| |||
1336 | 1296 | | |
1337 | 1297 | | |
1338 | 1298 | | |
| 1299 | + | |
| 1300 | + | |
1339 | 1301 | | |
1340 | | - | |
| 1302 | + | |
1341 | 1303 | | |
1342 | 1304 | | |
1343 | 1305 | | |
| |||
0 commit comments