mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-26 07:53:29 +00:00
fix(repo): prevent MarkAsBrokenEmpty when repository is being migrated (#39091)
This commit is contained in:
@@ -695,6 +695,12 @@ func repoAssignmentPrepareGitRepo(ctx *Context, data *repoAssignmentPrepareDataS
|
||||
ctx.Repo.GitRepo, err = git.RepositoryFromRequestContextOrOpen(ctx, repo)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "repository does not exist") || strings.Contains(err.Error(), "no such file or directory") {
|
||||
// A repository that is still being created (migrated or forked) does not have its
|
||||
// git data on disk yet, so opening it fails. This is expected and must not be
|
||||
// treated as a permanently broken repository.
|
||||
if ctx.Repo.Repository.IsBeingCreated() {
|
||||
return
|
||||
}
|
||||
log.Error("Repository %-v has a broken repository on the file system: %s Error: %v", ctx.Repo.Repository, ctx.Repo.Repository.FullName(), err)
|
||||
ctx.Repo.Repository.MarkAsBrokenEmpty()
|
||||
// Only allow access to base of repo or settings
|
||||
|
||||
Reference in New Issue
Block a user