Skip to content

Commit e3db952

Browse files
committed
adressing review comments
1 parent e8344e1 commit e3db952

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

cmd/checkout.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,13 @@ func checkoutRemoteStack(cfg *config.Config, sf *stack.StackFile, gitDir string,
211211
localStack := findLocalStackForRemotePRs(sf, prs)
212212

213213
if localStack != nil {
214+
// Sync remote PR metadata before comparing composition so locally
215+
// tracked stacks with incomplete PR refs don't appear to conflict.
216+
syncRemotePRState(localStack, prs)
217+
214218
// Case A: branch is in a local stack — check composition
215219
if stackCompositionMatches(localStack, remoteStack.PullRequests) {
216-
// Composition matches — sync PR state and checkout
217-
syncRemotePRState(localStack, prs)
220+
// Composition matches — checkout
218221
if localStack.ID == "" {
219222
localStack.ID = remoteStackID
220223
}
@@ -280,6 +283,9 @@ func fetchStackPRDetails(client github.ClientOps, prNumbers []int) ([]*github.Pu
280283
if err != nil {
281284
return nil, fmt.Errorf("fetching PR #%d: %w", n, err)
282285
}
286+
if pr == nil {
287+
return nil, fmt.Errorf("PR #%d not found", n)
288+
}
283289
prs = append(prs, pr)
284290
}
285291
return prs, nil
@@ -450,7 +456,8 @@ func importRemoteStack(
450456
if !git.BranchExists(trunk) {
451457
remoteTrunk := remote + "/" + trunk
452458
if err := git.CreateBranch(trunk, remoteTrunk); err != nil {
453-
cfg.Warningf("could not pull trunk branch %s: %v", trunk, err)
459+
cfg.Errorf("could not create trunk branch %s from %s: %v", trunk, remoteTrunk, err)
460+
return nil, ErrSilent
454461
}
455462
}
456463

cmd/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func clearSelectPrompt(cfg *config.Config, numOptions int) {
7979
}
8080
// 1 line for the question/filter + visible option lines
8181
lines := 1 + visible
82-
fmt.Fprintf(cfg.Err, "\033[%dA\033[J", lines)
82+
fmt.Fprintf(cfg.Out, "\033[%dA\033[J", lines)
8383
}
8484

8585
// loadStackResult holds everything returned by loadStack.

0 commit comments

Comments
 (0)