You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/models/repo
Giteabot 2048363f9e
Don't remove all mirror repository's releases when mirroring (#28817) (#28939)
Backport #28817 by @lunny

Fix #22066

# Purpose

This PR fix the releases will be deleted when mirror repository sync the
tags.

# The problem

In the previous implementation of #19125. All releases record in
databases of one mirror repository will be deleted before sync.
Ref:
https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481

# The Pros

This PR introduced a new method which will load all releases from
databases and all tags on git data into memory. And detect which tags
needs to be inserted, which tags need to be updated or deleted. Only
tags releases(IsTag=true) which are not included in git data will be
deleted, only tags which sha1 changed will be updated. So it will not
delete any real releases include drafts.

# The Cons

The drawback is the memory usage will be higher than before if there are
many tags on this repository. This PR defined a special release struct
to reduce columns loaded from database to memory.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 year ago
..
archiver.go Next round of `db.DefaultContext` refactor (#27089) 1 year ago
attachment.go More refactoring of `db.DefaultContext` (#27083) 1 year ago
attachment_test.go More refactoring of `db.DefaultContext` (#27083) 1 year ago
avatar.go Add context cache as a request level cache (#22294) 2 years ago
collaboration.go More `db.DefaultContext` refactor (#27265) (#27347) 1 year ago
collaboration_test.go More `db.DefaultContext` refactor (#27265) (#27347) 1 year ago
fork.go Reduce usage of `db.DefaultContext` (#27073) 1 year ago
fork_test.go refactor some functions to support ctx as first parameter (#21878) 2 years ago
git.go Reduce usage of `db.DefaultContext` (#27073) 1 year ago
issue.go Rename almost all Ctx functions (#22071) 2 years ago
language_stats.go Round language stats percentage using largest remainder (#22026) 2 years ago
main_test.go move repository deletion to service layer (#26948) 1 year ago
mirror.go More `db.DefaultContext` refactor (#27265) (#27347) 1 year ago
pushmirror.go Add `RemoteAddress` to mirrors (#26952) 1 year ago
pushmirror_test.go Replace `interface{}` with `any` (#25686) 2 years ago
redirect.go Implement FSFE REUSE for golang files (#21840) 2 years ago
redirect_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
release.go Don't remove all mirror repository's releases when mirroring (#28817) (#28939) 1 year ago
release_test.go Another round of `db.DefaultContext` refactor (#27103) (#27262) 1 year ago
repo.go Rework markup link rendering (#26745) (#28803) 1 year ago
repo_indexer.go Implement FSFE REUSE for golang files (#21840) 2 years ago
repo_list.go Restricted users only see repos in orgs which their team was assigned to (#28025) (#28051) 1 year ago
repo_list_test.go Replace 'userxx' with 'orgxx' in all test files when the user type is org (#27052) 1 year ago
repo_test.go Refactor SSH clone URL generation code (#28421) (#28480) 1 year ago
repo_unit.go Fix schedule tasks bugs (#28691) (#28780) 1 year ago
repo_unit_test.go add disable workflow feature (#26413) 2 years ago
search.go Split "modules/context.go" to separate files (#24569) 2 years ago
star.go More refactoring of `db.DefaultContext` (#27083) 1 year ago
star_test.go More refactoring of `db.DefaultContext` (#27083) 1 year ago
topic.go Next round of `db.DefaultContext` refactor (#27089) 1 year ago
topic_test.go Next round of `db.DefaultContext` refactor (#27089) 1 year ago
update.go Next round of `db.DefaultContext` refactor (#27089) 1 year ago
upload.go More refactoring of `db.DefaultContext` (#27083) 1 year ago
user_repo.go Refactor authors dropdown (send get request from frontend to avoid long wait time) (#23890) 2 years ago
user_repo_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago
watch.go More refactoring of `db.DefaultContext` (#27083) 1 year ago
watch_test.go More refactoring of `db.DefaultContext` (#27083) 1 year ago
wiki.go Implement FSFE REUSE for golang files (#21840) 2 years ago
wiki_test.go Implement FSFE REUSE for golang files (#21840) 2 years ago