Skip to content

feat: cascade rebase improvements (stdin fix, force-push, replaced-commits) - #339

Open
bkrupa wants to merge 4 commits into
mainfrom
feature/cascade-improvements
Open

feat: cascade rebase improvements (stdin fix, force-push, replaced-commits)#339
bkrupa wants to merge 4 commits into
mainfrom
feature/cascade-improvements

Conversation

@bkrupa

@bkrupa bkrupa commented Feb 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improves the cascade rebase workflow with three related enhancements:

  1. Stdin inheritance fix - Rebase commands now properly inherit stdin, fixing interactive rebase sessions during cascade operations
  2. Force-push flag - Adds --force-push flag to automatically force-push branches after successful cascade rebase
  3. Replaced-commits tracking - Tracks which commits were replaced during rebase for better conflict resolution reporting

Files changed

  • twig-cli/src/cli/cascade.rs - Force-push support, replaced-commits tracking, stdin fix
  • twig-cli/src/cli/rebase.rs - Stdin inheritance for rebase subprocess

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @bkrupa, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

…tracking

- Fix interactive rebase by inheriting stdin/stdout/stderr (Stdio::inherit)
- Add --force-push flag to cascade with --force-with-lease safety
- Track replaced/skipped commits during cascade for descendant awareness
- Add get_rebase_head_commit helper for REBASE_HEAD resolution
- Add preview mode (--preview) to show rebase plan without executing
- Extract shared git command helpers into twig-cli/src/git_commands.rs
  (GitCommandOutput, execute_git_command, execute_git_command_interactive,
  resolve_branch_remote) removing the duplicate implementations that had
  diverged between cascade.rs and rebase.rs (issue 6)

- Reduce rebase_downstream to two parameters (repo_path + &CascadeArgs)
  instead of seven positional bool arguments (issue 11)

- Fix formatting mangle in the force-rebase success match arm (issue 3)

- Strip trailing whitespace from the --force-push doc comment (issue 8)

- Check execute_git_command_interactive success status after rebase
  --continue and --skip in both cascade.rs and rebase.rs; propagate
  failures instead of falling through to print_success (issues 2, 7)

- Remove unnecessary .clone() on commit_hash by moving the value after
  computing the short-hash prefix (issue 9)

- Correct misleading log messages: replaced_commits entries are now
  described as 'noted' with a TODO explaining what is needed to actually
  wire them into downstream rebases (issue 1)

- Resolve the upstream remote via git config branch.<name>.remote in
  handle_force_push, falling back to 'origin' only when none is set
  (issue 4)

- Return Err from handle_force_push on failure; the cascade now reports
  overall failure when --force-push was explicitly requested (issue 5)

- Add unit tests for get_rebase_head_commit, CascadeArgs.force_push, and
  handle_force_push error behavior; add integration test verifying that
  cascade fails when --force-push is set but no remote is configured
  (issue 10)

- Fix missing force_push field in run_cascade_command test helper that
  would have broken compilation on Unix
@bkrupa
bkrupa force-pushed the feature/cascade-improvements branch from 7ecc16b to 9f8745d Compare February 26, 2026 01:26
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.

1 participant