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
This commit is contained in:
parent
572af214a7
commit
a6450494c3
8 changed files with 20 additions and 16 deletions
|
@ -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{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue