mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-18 17:00:02 +02:00
Modify behaviour of repo-delete. (#3232)
Re: issues gogits/gogs#2863 and gogits/gogs#3231 As a result of modifications to the contents of the conf folder, `make bindata` was run, causing an update to bindata.go. Meta ----- This commit will be rebased onto the 'develop' branch.
This commit is contained in:
parent
d62ab49978
commit
467d7dacb6
5 changed files with 704 additions and 941 deletions
|
@ -1409,21 +1409,9 @@ func DeleteRepository(uid, repoID int64) error {
|
|||
}
|
||||
|
||||
if repo.NumForks > 0 {
|
||||
if repo.IsPrivate {
|
||||
forkRepos, err := GetRepositoriesByForkID(repo.ID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("getRepositoriesByForkID: %v", err)
|
||||
}
|
||||
for i := range forkRepos {
|
||||
if err = DeleteRepository(forkRepos[i].OwnerID, forkRepos[i].ID); err != nil {
|
||||
log.Error(4, "DeleteRepository [%d]: %v", forkRepos[i].ID, err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if _, err = x.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil {
|
||||
log.Error(4, "reset 'fork_id' and 'is_fork': %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue