Skip to content

fix: reject a remote-tracking --base up front instead of failing at PR creation - #144

Merged
vitali87 merged 4 commits into
mainfrom
fix/reject-remote-tracking-base
Aug 31, 2026
Merged

fix: reject a remote-tracking --base up front instead of failing at PR creation#144
vitali87 merged 4 commits into
mainfrom
fix/reject-remote-tracking-base

Conversation

@vitali87

Copy link
Copy Markdown
Owner

Summary

pr-split split feature --base origin/main passed input validation (git rev-parse --verify origin/main succeeds), so the whole split ran — branches created and pushed, plan saved with base_branch="origin/main" — and only failed at the very end when gh pr create --base origin/main was rejected because GitHub has no branch of that name. The same applied to a tag or a SHA, and to execute on such a plan.

A new _require_local_branch(base) refuses anything that is not refs/heads/<base> before any worktree, prompt or branch creation, in both split and execute:

Base 'origin/main' is not a local branch; sub-PRs are opened against it on GitHub, so pass the branch name (for example 'main')

The "for example" hint is only added when the input is <remote>/<name> (or refs/remotes/<remote>/<name>) for a remote listed by git remote; tags and SHAs get the message without a bogus suggestion.

Test plan

  • TestValidateInputs: origin/main rejected with the hint, tag/SHA/feature/topic rejected without one, refs/remotes/origin/main suggests main, local base checks the branch head; execute refuses an old plan with a remote-tracking base before the confirm prompt — all fail on main
  • Review verified on a real repo with a bare origin (split and execute paths); a local branch literally named origin/main is still accepted
  • 449 tests pass, ruff clean
  • Local review: 5/5

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 44 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eaf13bc5-64ce-49bf-929d-21fedc33001a

📥 Commits

Reviewing files that changed from the base of the PR and between ec2f754 and 94613fd.

📒 Files selected for processing (3)
  • pr_split/cli.py
  • pr_split/exceptions.py
  • tests/test_cli_coverage.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vitali87
vitali87 merged commit 3f9581d into main Aug 31, 2026
4 checks passed
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