1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fix incorrect divergence cache after switching default branch (#34370) (#34406)

Backport #34370 by @GWDx

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

Co-authored-by: GWDx <gwdx@mail.ustc.edu.cn>
This commit is contained in:
Giteabot
2025-05-09 07:31:34 +08:00
committed by GitHub
parent be1090cb2d
commit 947358dffe
3 changed files with 105 additions and 3 deletions

View File

@@ -663,6 +663,11 @@ func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, newB
}
}
// clear divergence cache
if err := DelRepoDivergenceFromCache(ctx, repo.ID); err != nil {
log.Error("DelRepoDivergenceFromCache: %v", err)
}
notify_service.ChangeDefaultBranch(ctx, repo)
return nil