1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Decrement Fork Num when converting from Fork (#17035)

When converting repositories from forks to normal the root NumFork needs to be
decremented too.

Fix #17026

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath
2021-09-14 18:07:08 +01:00
committed by GitHub
parent 26ef180f46
commit 0a542dd59f
3 changed files with 39 additions and 4 deletions

View File

@@ -1209,6 +1209,12 @@ func IncrementRepoForkNum(ctx DBContext, repoID int64) error {
return err
}
// DecrementRepoForkNum decrement repository fork number
func DecrementRepoForkNum(ctx DBContext, repoID int64) error {
_, err := ctx.e.Exec("UPDATE `repository` SET num_forks=num_forks-1 WHERE id=?", repoID)
return err
}
// ChangeRepositoryName changes all corresponding setting from old repository name to new one.
func ChangeRepositoryName(doer *User, repo *Repository, newRepoName string) (err error) {
oldRepoName := repo.Name