Skip to content

fix(git): support repair on older Git versions - #40

Closed
gabelease wants to merge 2 commits into
kitlangton:mainfrom
gabelease:fix/older-cherry-pick
Closed

gabelease wants to merge 2 commits into
kitlangton:mainfrom
gabelease:fix/older-cherry-pick

Conversation

@gabelease

@gabelease gabelease commented Jul 14, 2026

Copy link
Copy Markdown

Makes stack repair work on Git installations that do not support cherry-pick --empty=drop, including Apple Git 2.39.5.

Why

The current replay command exits at argument parsing on these installations, so otherwise valid stack repairs fail before any commit is replayed.

Fix

  • Replay commits sequentially without the unsupported option.
  • Skip commits only when Git reports that the active cherry-pick became empty.
  • Preserve the existing conflict path for every other failure.
  • Add focused coverage for empty-commit handling and a patch changeset.

Risk and review focus

Risk: Git reports empty cherry-picks through stderr rather than a dedicated status.
→ Detection is limited to the two known empty-pick messages; other errors still surface as ReplayConflictError with unmerged paths.

Test plan

bun run typecheck
bun run test
bun run lint
bun run format:check
bun run package:smoke
bun run changeset:status --since upstream/main

Verified on Apple Git 2.39.5: all 135 tests pass.

Rollback

Revert this PR to restore the existing multi-commit cherry-pick --empty=drop replay path.

Replay commits one at a time so installations without cherry-pick --empty=drop can still repair stacks. Empty commits are skipped explicitly while real conflicts keep the existing recovery path.
@kitlangton

Copy link
Copy Markdown
Owner

Thanks for isolating the older-Git failure. I reproduced it with Git 2.39.5 and opened #47 with a state-based implementation that avoids localized stderr matching. It also guards against rerere.autoupdate making a conflict look like an empty pick. All 169 tests pass locally on Git 2.39.5 and Apple Git 2.50.1.

@kitlangton

Copy link
Copy Markdown
Owner

#47 is now merged, superseding this PR. Thanks again for identifying the compatibility problem and contributing the initial fix. The replacement was verified on Git 2.39.5 and Apple Git 2.50.1 and is queued for the 0.4.4 release.

@kitlangton kitlangton closed this Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants