mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-01 06:48:56 +00:00
7578022870
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>
(cherry picked from commit
|
||
---|---|---|
.. | ||
archiver.go | ||
attachment.go | ||
attachment_test.go | ||
avatar.go | ||
collaboration.go | ||
collaboration_test.go | ||
fork.go | ||
fork_test.go | ||
git.go | ||
issue.go | ||
language_stats.go | ||
main_test.go | ||
mirror.go | ||
pushmirror.go | ||
pushmirror_test.go | ||
redirect.go | ||
redirect_test.go | ||
release.go | ||
release_test.go | ||
repo.go | ||
repo_indexer.go | ||
repo_list.go | ||
repo_list_test.go | ||
repo_test.go | ||
repo_unit.go | ||
repo_unit_test.go | ||
search.go | ||
star.go | ||
star_test.go | ||
topic.go | ||
topic_test.go | ||
update.go | ||
upload.go | ||
user_repo.go | ||
user_repo_test.go | ||
watch.go | ||
watch_test.go | ||
wiki.go | ||
wiki_test.go |