summaryrefslogtreecommitdiffstats
path: root/modules/repository/repo.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-08-11 21:05:34 +0100
committerGitHub <noreply@github.com>2020-08-11 21:05:34 +0100
commit74bd9691c685942798f2761607731697498ceeae (patch)
tree531d661263b839ccf8aa6af73bfb6710984f0dd9 /modules/repository/repo.go
parentfaa676cc8b4419ac56fbf9d009ea8c6b79834024 (diff)
downloadgitea-74bd9691c685942798f2761607731697498ceeae.tar.gz
gitea-74bd9691c685942798f2761607731697498ceeae.zip
Re-attempt to delete temporary upload if the file is locked by another process (#12447)
Replace all calls to os.Remove/os.RemoveAll by retrying util.Remove/util.RemoveAll and remove circular dependencies from util. Fix #12339 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'modules/repository/repo.go')
-rw-r--r--modules/repository/repo.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/repository/repo.go b/modules/repository/repo.go
index 01d4701c71..2d5551d987 100644
--- a/modules/repository/repo.go
+++ b/modules/repository/repo.go
@@ -6,7 +6,6 @@ package repository
import (
"fmt"
- "os"
"path"
"strings"
"time"
@@ -17,6 +16,7 @@ import (
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
+ "code.gitea.io/gitea/modules/util"
"gopkg.in/ini.v1"
)
@@ -57,7 +57,7 @@ func MigrateRepositoryGitData(doer, u *models.User, repo *models.Repository, opt
migrateTimeout := time.Duration(setting.Git.Timeout.Migrate) * time.Second
var err error
- if err = os.RemoveAll(repoPath); err != nil {
+ if err = util.RemoveAll(repoPath); err != nil {
return repo, fmt.Errorf("Failed to remove %s: %v", repoPath, err)
}
@@ -73,7 +73,7 @@ func MigrateRepositoryGitData(doer, u *models.User, repo *models.Repository, opt
wikiPath := models.WikiPath(u.Name, opts.RepoName)
wikiRemotePath := WikiRemoteURL(opts.CloneAddr)
if len(wikiRemotePath) > 0 {
- if err := os.RemoveAll(wikiPath); err != nil {
+ if err := util.RemoveAll(wikiPath); err != nil {
return repo, fmt.Errorf("Failed to remove %s: %v", wikiPath, err)
}
@@ -84,7 +84,7 @@ func MigrateRepositoryGitData(doer, u *models.User, repo *models.Repository, opt
Branch: "master",
}); err != nil {
log.Warn("Clone wiki: %v", err)
- if err := os.RemoveAll(wikiPath); err != nil {
+ if err := util.RemoveAll(wikiPath); err != nil {
return repo, fmt.Errorf("Failed to remove %s: %v", wikiPath, err)
}
}