diff options
Diffstat (limited to 'modules/repository/init.go')
-rw-r--r-- | modules/repository/init.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/repository/init.go b/modules/repository/init.go index 569069ee1f..37dc69a0a8 100644 --- a/modules/repository/init.go +++ b/modules/repository/init.go @@ -175,7 +175,12 @@ func initRepoCommit(tmpPath string, repo *models.Repository, u *models.User, def func checkInitRepository(owner, name string) (err error) { // Somehow the directory could exist. repoPath := models.RepoPath(owner, name) - if com.IsExist(repoPath) { + isExist, err := util.IsExist(repoPath) + if err != nil { + log.Error("Unable to check if %s exists. Error: %v", repoPath, err) + return err + } + if isExist { return models.ErrRepoFilesAlreadyExist{ Uname: owner, Name: name, @@ -192,7 +197,12 @@ func checkInitRepository(owner, name string) (err error) { } func adoptRepository(ctx models.DBContext, repoPath string, u *models.User, repo *models.Repository, opts models.CreateRepoOptions) (err error) { - if !com.IsExist(repoPath) { + isExist, err := util.IsExist(repoPath) + if err != nil { + log.Error("Unable to check if %s exists. Error: %v", repoPath, err) + return err + } + if !isExist { return fmt.Errorf("adoptRepository: path does not already exist: %s", repoPath) } |