File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,19 @@ func (repo *Repository) MarkAsBrokenEmpty() {
320320 repo .IsEmpty = true
321321}
322322
323+ func (repo * Repository ) MarkAsNormal () {
324+ repo .IsEmpty = false
325+ repo .Status = RepositoryReady
326+ }
327+
328+ func MarkBrokenRepoAsNormal (ctx context.Context , repo * Repository ) error {
329+ repo .MarkAsNormal ()
330+ if _ , err := db .GetEngine (ctx ).ID (repo .ID ).Cols ("status" , "is_empty" ).Update (repo ); err != nil {
331+ return fmt .Errorf ("update repository: %w" , err )
332+ }
333+ return nil
334+ }
335+
323336// AfterLoad is invoked from XORM after setting the values of all fields of this object.
324337func (repo * Repository ) AfterLoad () {
325338 repo .NumOpenIssues = repo .NumIssues - repo .NumClosedIssues
Original file line number Diff line number Diff line change @@ -567,7 +567,7 @@ func RepoAssignment(ctx *Context) {
567567 ctx .Link == ctx .Repo .RepoLink + "/-/migrate/status"
568568
569569 // Disable everything when the repo is being created
570- if ctx .Repo .Repository .IsBeingCreated () || ctx . Repo . Repository . IsBroken () {
570+ if ctx .Repo .Repository .IsBeingCreated () {
571571 if ! isHomeOrSettings {
572572 ctx .Redirect (ctx .Repo .RepoLink )
573573 }
@@ -595,6 +595,13 @@ func RepoAssignment(ctx *Context) {
595595 return
596596 }
597597
598+ // The repository can be open but marked as broken
599+ if ctx .Repo .Repository .IsBroken () {
600+ if err = repo_model .MarkBrokenRepoAsNormal (ctx , ctx .Repo .Repository ); err != nil {
601+ log .Error ("MarkBrokenRepoAsNormal: %v" , err )
602+ }
603+ }
604+
598605 // Stop at this point when the repo is empty.
599606 if ctx .Repo .Repository .IsEmpty {
600607 return
You can’t perform that action at this time.
0 commit comments