@@ -134,6 +134,15 @@ func processBranch(branch string, baseCommit string) migrationResult {
134134
135135 // Re-check commits after rebase (hashes may have changed)
136136 commitsAhead = getCommitsAhead (baseCommit , "HEAD" )
137+ if len (commitsAhead ) == 0 {
138+ slog .Info (fmt .Sprint ("Branch " , branch , " has no commits after rebase - skipping" ))
139+ return migrationResult {
140+ branchName : branch ,
141+ success : false ,
142+ reason : "no commits after rebase" ,
143+ numCommits : 0 ,
144+ }
145+ }
137146 slog .Debug (fmt .Sprint ("Found " , len (commitsAhead ), " commits ahead of main for branch " , branch ))
138147 for _ , commit := range commitsAhead {
139148 slog .Debug (fmt .Sprint (" - " , commit ))
@@ -204,7 +213,7 @@ func findUserBranches() []string {
204213 result [i ] = b .name
205214 }
206215
207- slog .Info (fmt .Sprint ("Found " , len (result ), " branches with your commits" ))
216+ slog .Debug (fmt .Sprint ("Found " , len (result ), " branches with your commits" ))
208217 return result
209218}
210219
@@ -261,18 +270,18 @@ func selectBranchesToMigrate(branches []string) []string {
261270 }
262271
263272 if len (disabledBranches ) == len (branches ) {
264- slog .Info ("All branches already exist on main - nothing to migrate" )
273+ slog .Debug ("All branches already exist on main - nothing to migrate" )
265274 util .Fprintln (appConfig .Io .Out , "All branches have already been migrated to main" )
266275 return []string {}
267276 }
268277
269- slog .Info ("Starting interactive branch selection..." )
278+ slog .Debug ("Starting interactive branch selection..." )
270279 selectedBranches , err := interactive .GetBranchSelectionWithFilter (
271280 branches ,
272281 "Select branches to migrate (use space to select/deselect, enter to confirm):" ,
273282 rowEnabled ,
274283 )
275- slog .Info ("Interactive selection completed" )
284+ slog .Debug ("Interactive selection completed" )
276285 if err != nil {
277286 slog .Warn ("Failed to get branch selection: " + err .Error ())
278287 return []string {}
@@ -284,10 +293,10 @@ func selectBranchesToMigrate(branches []string) []string {
284293// computeDisabledBranches returns a set of branch indices that already have their
285294// commits on main and should be disabled in the interactive selector.
286295func computeDisabledBranches (branches []string ) map [int ]bool {
287- slog .Info ("Fetching commits from main for branch filtering..." )
296+ slog .Debug ("Fetching commits from main for branch filtering..." )
288297 mainBranch := gitutil .GetLocalMainBranchOrDie ()
289298 mainCommits := templates .GetNewCommits (mainBranch , "" )
290- slog .Info (fmt .Sprint ("Found " , len (mainCommits ), " commits on main for branch filtering" ))
299+ slog .Debug (fmt .Sprint ("Found " , len (mainCommits ), " commits on main for branch filtering" ))
291300
292301 branchesOnMain := make (map [string ]bool )
293302 for _ , commit := range mainCommits {
@@ -296,12 +305,12 @@ func computeDisabledBranches(branches []string) map[int]bool {
296305 }
297306 }
298307
299- slog .Info ("Building branch filter..." )
308+ slog .Debug ("Building branch filter..." )
300309 disabledBranches := make (map [int ]bool )
301310 for i , branch := range branches {
302311 if branchesOnMain [branch ] {
303312 disabledBranches [i ] = true
304- slog .Info (fmt .Sprint ("Branch " , branch , " already exists on main - will be disabled" ))
313+ slog .Debug (fmt .Sprint ("Branch " , branch , " already exists on main - will be disabled" ))
305314 }
306315 }
307316 return disabledBranches
@@ -319,7 +328,7 @@ func findMostRecentMainCommit(branches []string) string {
319328
320329 // For each branch, find its merge-base with origin/main
321330 for _ , branch := range allBranches {
322- mergeBase := gitutil .FirstOriginMainCommit (branch )
331+ mergeBase := gitutil .GetMergeBaseWithOriginMain (branch )
323332 slog .Debug (fmt .Sprint ("Merge-base for " , branch , " with origin/main: " , mergeBase ))
324333
325334 // Get the timestamp of this commit
0 commit comments