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
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>
2 years ago
..
admin Use a struct as test options (#19393) 3 years ago
appstate Sync gitea app path for git hooks and authorized keys when starting (#17335) 3 years ago
asymkey Move some repository related code into sub package (#19711) 3 years ago
auth WebAuthn CredentialID field needs to be increased in size (#20530) (#20555) 3 years ago
avatars format with gofumpt (#18184) 3 years ago
db Add migrate repo archiver and packages storage support on command line (#20757) (#20806) 2 years ago
fixtures Exclude Archived repos from Dashboard Milestones (#19882) 3 years ago
foreignreference Store the foreign ID of issues during migration (#18446) 3 years ago
git Add migrate repo archiver and packages storage support on command line (#20757) (#20806) 2 years ago
issues Display project in issue list (#20583) 3 years ago
migrations Fix v220 migration to be compatible for MSSQL 2008 r2 (#20702) (#20707) 3 years ago
organization Move tests as seperate sub packages to reduce duplicated file names (#19951) 3 years ago
packages Add Docker /v2/_catalog endpoint (#20469) (#20556) 3 years ago
perm Store read access in access for team repo's (#20275) (#20276) 3 years ago
project Use correct count for `NumOpenIssues` (#19980) 3 years ago
pull Delete related PullAutoMerge and ReviewState on User/Repo Deletion (#19649) 3 years ago
repo Check Mirror exists before linking its Repo (#20840) (#20842) 2 years ago
unit Fix incorrect translation key (#19744) 3 years ago
unittest Use git.HOME_PATH for Git HOME directory (#20114) (#20293) 3 years ago
user Add migrate repo archiver and packages storage support on command line (#20757) (#20806) 2 years ago
webhook Check webhooks slice length before calling xorm (#20642) (#20768) 3 years ago
action.go Refix indices on actions table (#20158) (#20198) 3 years ago
action_list.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
action_test.go Move issues related files into models/issues (#19931) 3 years ago
consistency.go Move issues related files into models/issues (#19931) 3 years ago
error.go Move issues related files into models/issues (#19931) 3 years ago
fixture_generation.go Move access and repo permission to models/perm/access (#19350) 3 years ago
fixture_test.go Decouple unit test code from business code (#17623) 3 years ago
main_test.go Move issues related files into models/issues (#19931) 3 years ago
migrate.go Move issues related files into models/issues (#19931) 3 years ago
migrate_test.go Move issues related files into models/issues (#19931) 3 years ago
notification.go Move issues related files into models/issues (#19931) 3 years ago
notification_test.go Move issues related files into models/issues (#19931) 3 years ago
org.go In code search, get code unit accessible repos in one (main) query (#19764) 3 years ago
org_team.go Move issues related files into models/issues (#19931) 3 years ago
org_team_test.go Move access and repo permission to models/perm/access (#19350) 3 years ago
org_test.go Move tests as seperate sub packages to reduce duplicated file names (#19951) 3 years ago
release.go improvement some release related code (#19867) 3 years ago
repo.go Move issues related files into models/issues (#19931) 3 years ago
repo_activity.go Move issues related files into models/issues (#19931) 3 years ago
repo_collaboration.go Move issues related files into models/issues (#19931) 3 years ago
repo_collaboration_test.go Move tests as seperate sub packages to reduce duplicated file names (#19951) 3 years ago
repo_test.go Move tests as seperate sub packages to reduce duplicated file names (#19951) 3 years ago
repo_transfer.go Move issues related files into models/issues (#19931) 3 years ago
repo_transfer_test.go Move repository model into models/repo (#17933) 3 years ago
statistic.go Move issues related files into models/issues (#19931) 3 years ago
task.go Move almost all functions' parameter db.Engine to context.Context (#19748) 3 years ago
token.go Use base32 for 2FA scratch token (#18384) 3 years ago
token_test.go A better go code formatter, and now `make fmt` can run in Windows (#17684) 3 years ago
upload.go Remove NewSession method from db.Engine interface (#17577) 3 years ago
user.go Move issues related files into models/issues (#19931) 3 years ago
user_heatmap.go Move organization related structs into sub package (#18518) 3 years ago
user_heatmap_test.go RSS/Atom support for Repos (#19055) 3 years ago