Skip to content

Commit eb39abc

Browse files
committed
handle CheckoutBranch errors
1 parent f9fbd25 commit eb39abc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

internal/modify/apply.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,11 @@ func ApplyPlan(
498498
// Check out the best branch — the original if it's still in the stack,
499499
// otherwise the nearest surviving branch.
500500
targetBranch := resolveCheckoutBranch(currentBranch, plan, snapshot, s)
501-
_ = git.CheckoutBranch(targetBranch)
501+
if err := git.CheckoutBranch(targetBranch); err == nil {
502502
if targetBranch != currentBranch {
503503
cfg.Printf("Switched to %s (original branch %s is no longer in the stack)", targetBranch, currentBranch)
504504
}
505+
}
505506

506507
// Update base SHAs
507508
updateBaseSHAs(s)
@@ -762,9 +763,10 @@ func ContinueApply(
762763
// All rebases done — check out the best branch
763764
if state.OriginalBranch != "" {
764765
targetBranch := resolveCheckoutBranch(state.OriginalBranch, state.Plan, state.Snapshot, s)
765-
_ = git.CheckoutBranch(targetBranch)
766+
if err := git.CheckoutBranch(targetBranch); err == nil {
766767
if targetBranch != state.OriginalBranch {
767768
cfg.Printf("Switched to %s (original branch %s is no longer in the stack)", targetBranch, state.OriginalBranch)
769+
}
768770
}
769771
}
770772

0 commit comments

Comments
 (0)