summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-04-28 20:14:26 +0200
committerGitHub <noreply@github.com>2023-04-28 20:14:26 +0200
commita6450494c3a9c05667ae8a2ebdfdea55b8206e9b (patch)
treee4c6eba554eb4866337f82f2f96521b4b9370f84 /services
parentEnsure final newline in `assets/go-licenses.json` (#24407) (diff)
downloadforgejo-a6450494c3a9c05667ae8a2ebdfdea55b8206e9b.tar.xz
forgejo-a6450494c3a9c05667ae8a2ebdfdea55b8206e9b.zip
Fix unclear `IsRepositoryExist` logic (#24374)
There was only one `IsRepositoryExist` function, it did: `has && isDir` However it's not right, and it would cause 500 error when creating a new repository if the dir exists. Then, it was changed to `has || isDir`, it is still incorrect, it affects the "adopt repo" logic. To make the logic clear: * IsRepositoryModelOrDirExist * IsRepositoryModelExist
Diffstat (limited to 'services')
-rw-r--r--services/repository/adopt.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/repository/adopt.go b/services/repository/adopt.go
index 94b2c3f3d5..55e77a78a7 100644
--- a/services/repository/adopt.go
+++ b/services/repository/adopt.go
@@ -206,7 +206,7 @@ func DeleteUnadoptedRepository(ctx context.Context, doer, u *user_model.User, re
}
}
- if exist, err := repo_model.IsRepositoryExist(ctx, u, repoName); err != nil {
+ if exist, err := repo_model.IsRepositoryModelExist(ctx, u, repoName); err != nil {
return err
} else if exist {
return repo_model.ErrRepoAlreadyExist{