Skip to content

Commit aec8d9b

Browse files
committed
Fix incorrect divergence cache after switching default branch
Issue: After switching the default branch, other branches are still compared against the old default branch due to outdated divergence cache. Change: Clear the divergence cache in SetRepoDefaultBranch to ensure correct comparisons against the new default branch. Fixes #34369
1 parent 833c2a4 commit aec8d9b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

services/repository/branch.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,12 @@ func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, newB
639639
if err := actions_model.DeleteScheduleTaskByRepo(ctx, repo.ID); err != nil {
640640
log.Error("DeleteCronTaskByRepo: %v", err)
641641
}
642+
643+
// clear divergence cache
644+
if err := DelRepoDivergenceFromCache(ctx, repo.ID); err != nil {
645+
log.Error("DelRepoDivergenceFromCache: %v", err)
646+
}
647+
642648
// cancel running cron jobs of this repository and delete old schedules
643649
if err := actions_service.CancelPreviousJobs(
644650
ctx,

0 commit comments

Comments
 (0)