Repository navigation
fix(rebase): preserve failures before rebase starts - #2
windsornguyen wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bdf3b37fae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for i := 0; i < 1000; i++ { | ||
| if !IsRebaseInProgress() { | ||
| return nil | ||
| return originalErr |
There was a problem hiding this comment.
Treat non-started rebase errors as fatal
When git rebase fails before creating .git/rebase-* (for example an invalid or missing branch/old-base ref), this now returns a non-nil error while IsRebaseInProgress() is false. The stack callers such as cascadeRebase treat any non-nil Rebase/RebaseOnto error as a recoverable conflict, save gh-stack-rebase-state, and tell users to run gh stack rebase --continue, but there is no Git rebase to continue, so the original failure is still not surfaced correctly and the user is left in a bogus recovery state. Please return a distinguishable fatal error here or update callers to branch on whether a rebase actually started.
Useful? React with 👍 / 👎.
Reproduction
A rebase can fail before Git creates rebase state, such as when the target branch is missing.
tryAutoResolveRebasesees no active rebase and returns success.Fixes github#35.
Change
Returns the original Git error when no rebase was started.
Proof
nilbefore this change and the Git error after itgo vet ./...go test -race -count=1 ./...