summaryrefslogtreecommitdiffstats
path: root/models/update.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/update.go')
-rw-r--r--models/update.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/models/update.go b/models/update.go
index 62d13ce209..82369bf636 100644
--- a/models/update.go
+++ b/models/update.go
@@ -11,7 +11,7 @@ import (
"strings"
"code.gitea.io/git"
-
+ "code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/log"
)
@@ -205,19 +205,26 @@ func pushUpdate(opts PushUpdateOptions) (repo *Repository, err error) {
var commits = &PushCommits{}
if strings.HasPrefix(opts.RefFullName, git.TagPrefix) {
// If is tag reference
+ tagName := opts.RefFullName[len(git.TagPrefix):]
if isDelRef {
- err = pushUpdateDeleteTag(repo, gitRepo, opts.RefFullName[len(git.TagPrefix):])
+ err = pushUpdateDeleteTag(repo, gitRepo, tagName)
if err != nil {
return nil, fmt.Errorf("pushUpdateDeleteTag: %v", err)
}
} else {
- err = pushUpdateAddTag(repo, gitRepo, opts.RefFullName[len(git.TagPrefix):])
+ // Clear cache for tag commit count
+ cache.Remove(repo.GetCommitsCountCacheKey(tagName, true))
+ err = pushUpdateAddTag(repo, gitRepo, tagName)
if err != nil {
return nil, fmt.Errorf("pushUpdateAddTag: %v", err)
}
}
} else if !isDelRef {
// If is branch reference
+
+ // Clear cache for branch commit count
+ cache.Remove(repo.GetCommitsCountCacheKey(opts.RefFullName[len(git.BranchPrefix):], true))
+
newCommit, err := gitRepo.GetCommit(opts.NewCommitID)
if err != nil {
return nil, fmt.Errorf("gitRepo.GetCommit: %v", err)