Skip to content

Commit

Permalink
[MER-2485] Separate the branch deletion messages (#183)
Browse files Browse the repository at this point in the history
Currently the branch deletion messages are concatenated to the previous
sync operation output. Separate the messages.

This also shows the message when no branch is deleted.
  • Loading branch information
draftcode authored Jun 26, 2023
1 parent c343837 commit f7f39da
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/actions/sync_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,17 @@ func SyncStack(ctx context.Context,
}

if state.Config.Prune {
// Add spacing in the output between each branch sync
if len(branchesToSync) > 0 {
_, _ = fmt.Fprint(os.Stderr, "\n\n")
}
_, _ = fmt.Fprint(os.Stderr, "Finding merged branches to delete...\n")

remoteBranches, err := repo.LsRemote("origin")
if err != nil {
return err
}
branchDeleted := false
for _, currentBranch := range branchesToSync {
br, _ := tx.Branch(currentBranch)
if br.MergeCommit == "" {
Expand Down Expand Up @@ -195,6 +202,10 @@ func SyncStack(ctx context.Context,
// The original branch is deleted.
state.OriginalBranch = ""
}
branchDeleted = true
}
if !branchDeleted {
_, _ = fmt.Fprint(os.Stderr, " - no branch was deleted\n")
}
}

Expand Down

0 comments on commit f7f39da

Please sign in to comment.