mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-14 18:33:49 +09:00
Use gitrepo's clone and push when possible (#36093)
1 Move `IsRepositoryModelOrDirExist` and `CheckCreateRepository` to service layer 2 Use `gitrepo.Pushxxx` instead of `git.Push` when possible 3 use `gitrepo.Clonexxx` instead of `gitrepo.Clone` when possible
This commit is contained in:
@@ -869,16 +869,6 @@ func GetRepositoriesMapByIDs(ctx context.Context, ids []int64) (map[int64]*Repos
|
||||
return repos, db.GetEngine(ctx).In("id", ids).Find(&repos)
|
||||
}
|
||||
|
||||
// IsRepositoryModelOrDirExist returns true if the repository with given name under user has already existed.
|
||||
func IsRepositoryModelOrDirExist(ctx context.Context, u *user_model.User, repoName string) (bool, error) {
|
||||
has, err := IsRepositoryModelExist(ctx, u, repoName)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
isDir, err := util.IsDir(RepoPath(u.Name, repoName))
|
||||
return has || isDir, err
|
||||
}
|
||||
|
||||
func IsRepositoryModelExist(ctx context.Context, u *user_model.User, repoName string) (bool, error) {
|
||||
return db.GetEngine(ctx).Get(&Repository{
|
||||
OwnerID: u.ID,
|
||||
|
||||
Reference in New Issue
Block a user