Fix push multiple branches error with tests (#31151) (#31153)

Backport #31151 by @lunny

Fix #31140 

The previous logic is wrong when pushing multiple branches. After first
branch updated, it will ignore left other branches sync operations.

As a workaround for the repositories, just push a new commit after the
patch applied will fix the repositories status.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Giteabot
2024-05-30 07:04:42 +00:00
committed by GitHub
co-authored by Lunny Xiao
parent cc64d4d2b2
commit e8c776c793
3 changed files with 54 additions and 1 deletions
+1 -1
View File
@@ -332,7 +332,7 @@ func SyncBranchesToDB(ctx context.Context, repoID, pusherID int64, branchNames,
if _, err := git_model.UpdateBranch(ctx, repoID, pusherID, branchName, commit); err != nil {
return fmt.Errorf("git_model.UpdateBranch %d:%s failed: %v", repoID, branchName, err)
}
return nil
continue
}
// if database have branches but not this branch, it means this is a new branch