Skip to content

feat: add support for git rerere#545

Merged
sorenlouv merged 3 commits intosorenlouv:mainfrom
kapral18:feat/add-rerere-support
Sep 17, 2025
Merged

feat: add support for git rerere#545
sorenlouv merged 3 commits intosorenlouv:mainfrom
kapral18:feat/add-rerere-support

Conversation

@kapral18
Copy link
Copy Markdown
Contributor

@kapral18 kapral18 commented Sep 11, 2025

Summary

Add rerere use cases detection by checking for rerere config variables and handling them accordingly.

Problem

With rerere.enabled and rerere.autoUpdate on, cherry-pick can fail while rerere reapplies resolutions and stages them, leaving no conflicts but causing the flow to wait unnecessarily.

Solution

After a cherry-pick error, if rerere.enabled and rerere.autoUpdate is enabled and there are no conflicts, proceed when staged > 0 and unstaged == 0; otherwise require resolution as before.

image

Tests

  • AutoUpdate=true: staged>0, unstaged=0 ⇒ needsResolving=false.
  • AutoUpdate=false: unstaged>0 ⇒ needsResolving=true.
  • Mixed staged/unstaged ⇒ needsResolving=true.
  • Conflicts present or rerere disabled ⇒ needsResolving=true.
  • AutoUpdate=true with no staged/unstaged ⇒ rethrow original cherry-pick error.

When git rerere is enabled and automatically resolves conflicts during
cherrypick, the process would previously hang because the tool didn't
recognize that conflicts were resolved. Now detects when rerere has
staged resolved files and continues the backport process smoothly.

- Add getStagedFiles() function to detect rerere-resolved conflicts
- Enhance cherrypick() to check for staged files when conflicts occur
- Add comprehensive test coverage for rerere scenarios
- Maintain backward compatibility when rerere is not used
@kapral18 kapral18 force-pushed the feat/add-rerere-support branch from 71965ff to 93d0fff Compare September 14, 2025 21:16
@kapral18 kapral18 changed the title Add support for git rerere during cherrypick conflicts feat: add support for git rerere during cherrypick conflicts Sep 14, 2025
@kapral18 kapral18 changed the title feat: add support for git rerere during cherrypick conflicts feat: add support for git rerere Sep 14, 2025
- improve logic with more defensive checks against git config
- differentiate between rerere.enabled and rerere.autoUpdate
- add comprehensive test coverage
@kapral18 kapral18 force-pushed the feat/add-rerere-support branch from 93d0fff to 16ac9ff Compare September 14, 2025 21:55
@sorenlouv sorenlouv merged commit 3124ebb into sorenlouv:main Sep 17, 2025
@sorenlouv
Copy link
Copy Markdown
Owner

Thank you @kapral18 ! Published in 10.1.0

@kapral18 kapral18 deleted the feat/add-rerere-support branch September 17, 2025 19:22
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