diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-05-09 00:46:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 18:46:32 +0200 |
commit | 4ca1d7547a2c32cc65ca23d1a7698d1a8c921d65 (patch) | |
tree | fee132403adea441987ce25809c764e00fd962cd /services/wiki/wiki.go | |
parent | d4834071da9ce010fd4677ef339c598dd23dc130 (diff) | |
download | gitea-4ca1d7547a2c32cc65ca23d1a7698d1a8c921d65.tar.gz gitea-4ca1d7547a2c32cc65ca23d1a7698d1a8c921d65.zip |
Move some helper files out of models (#19355)
* Move some helper files out of models
* Some improvements
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'services/wiki/wiki.go')
-rw-r--r-- | services/wiki/wiki.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go index 796291fd38..43e35eed69 100644 --- a/services/wiki/wiki.go +++ b/services/wiki/wiki.go @@ -133,12 +133,12 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model hasMasterBranch := git.IsBranchExist(ctx, repo.WikiPath(), "master") - basePath, err := models.CreateTemporaryPath("update-wiki") + basePath, err := repo_module.CreateTemporaryPath("update-wiki") if err != nil { return err } defer func() { - if err := models.RemoveTemporaryPath(basePath); err != nil { + if err := repo_module.RemoveTemporaryPath(basePath); err != nil { log.Error("Merge: RemoveTemporaryPath: %s", err) } }() @@ -249,7 +249,7 @@ func updateWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model if err := git.Push(gitRepo.Ctx, basePath, git.PushOptions{ Remote: "origin", Branch: fmt.Sprintf("%s:%s%s", commitHash.String(), git.BranchPrefix, "master"), - Env: models.FullPushingEnvironment( + Env: repo_module.FullPushingEnvironment( doer, doer, repo, @@ -287,12 +287,12 @@ func DeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model return fmt.Errorf("InitWiki: %v", err) } - basePath, err := models.CreateTemporaryPath("update-wiki") + basePath, err := repo_module.CreateTemporaryPath("update-wiki") if err != nil { return err } defer func() { - if err := models.RemoveTemporaryPath(basePath); err != nil { + if err := repo_module.RemoveTemporaryPath(basePath); err != nil { log.Error("Merge: RemoveTemporaryPath: %s", err) } }() @@ -363,7 +363,7 @@ func DeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model if err := git.Push(gitRepo.Ctx, basePath, git.PushOptions{ Remote: "origin", Branch: fmt.Sprintf("%s:%s%s", commitHash.String(), git.BranchPrefix, "master"), - Env: models.PushingEnvironment(doer, repo), + Env: repo_module.PushingEnvironment(doer, repo), }); err != nil { if git.IsErrPushOutOfDate(err) || git.IsErrPushRejected(err) { return err |