Skip to content

Commit 9902c62

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 9902c62

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

services/repository/branch.go

+5
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,11 @@ func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, newB
663663
}
664664
}
665665

666+
// clear divergence cache
667+
if err := DelRepoDivergenceFromCache(ctx, repo.ID); err != nil {
668+
log.Error("DelRepoDivergenceFromCache: %v", err)
669+
}
670+
666671
notify_service.ChangeDefaultBranch(ctx, repo)
667672

668673
return nil

0 commit comments

Comments
 (0)