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
Lunny Xiao c40c753613
Check Mirror exists before linking its Repo (#20840) (#20842)
In MirrorRepositoryList.loadAttributes there is some code to load the Mirror entries
from the database. This assumes that every Repository which has IsMirror set has
a Mirror associated in the DB. This association is incorrect in the case of
Mirror repository under creation when there is no Mirror entry in the DB until
completion.

Unfortunately LoadAttributes makes this incorrect assumption and presumes that a
Mirror will always be loaded. This then causes a panic.

This PR simply double checks if there a Mirror before attempting to link back to
its Repo. Unfortunately it should be expected that there may be other cases where
this incorrect assumption causes further problems.

Fix #20804

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years ago
..
archiver.go format with gofumpt (#18184) 3 years ago
attachment.go Add migrate repo archiver and packages storage support on command line (#20757) (#20806) 3 years ago
attachment_test.go Move some repository related code into sub package (#19711) 3 years ago
avatar.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
collaboration.go Move some code into models/git (#19879) 3 years ago
collaboration_test.go Move tests as seperate sub packages to reduce duplicated file names (#19951) 3 years ago
fork.go Feature: Find files in repo (#15028) 3 years ago
fork_test.go Move some repository related code into sub package (#19711) 3 years ago
git.go Move repository model into models/repo (#17933) 3 years ago
issue.go Prevent deadlock in create issue (#17970) 3 years ago
language_stats.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
main_test.go Feature: Find files in repo (#15028) 3 years ago
mirror.go Check Mirror exists before linking its Repo (#20840) (#20842) 3 years ago
pushmirror.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
pushmirror_test.go Move some repository related code into sub package (#19711) 3 years ago
redirect.go Some repository refactors (#17950) 3 years ago
redirect_test.go Move some repository related code into sub package (#19711) 3 years ago
repo.go Move issues related files into models/issues (#19931) 3 years ago
repo_indexer.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
repo_list.go Add migrate repo archiver and packages storage support on command line (#20757) (#20806) 3 years ago
repo_list_test.go Move some repository related code into sub package (#19711) 3 years ago
repo_test.go Move tests as seperate sub packages to reduce duplicated file names (#19951) 3 years ago
repo_unit.go Custom regexp external issues (#17624) 3 years ago
star.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
star_test.go Move some repository related code into sub package (#19711) 3 years ago
topic.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
topic_test.go Move some repository related code into sub package (#19711) 3 years ago
update.go Move some repository related code into sub package (#19711) 3 years ago
user_repo.go Move some repository related code into sub package (#19711) 3 years ago
user_repo_test.go Move some repository related code into sub package (#19711) 3 years ago
watch.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
watch_test.go Move some repository related code into sub package (#19711) 3 years ago
wiki.go Move repository model into models/repo (#17933) 3 years ago
wiki_test.go Move some repository related code into sub package (#19711) 3 years ago