diff options
author | zeripath <art27@cantab.net> | 2021-09-14 18:07:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 18:07:08 +0100 |
commit | 0a542dd59f8061797976f33690bf10357aa0b0ad (patch) | |
tree | a74494a0e8120e4bfd32583e152ef466641de17b /models/repo.go | |
parent | 26ef180f466046f9cfab87eea5ea93f5d6da6998 (diff) | |
download | gitea-0a542dd59f8061797976f33690bf10357aa0b0ad.tar.gz gitea-0a542dd59f8061797976f33690bf10357aa0b0ad.zip |
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>
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index 23287067e2..709fe6ab0e 100644 --- a/models/repo.go +++ b/models/repo.go @@ -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 |