summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/setting.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-01-19 23:26:57 +0000
committerGitHub <noreply@github.com>2022-01-19 23:26:57 +0000
commit5cb0c9aa0d7eed087055b1efca79628957207d36 (patch)
treed117a514e1f17e5f6bfcda1be273f6a971112663 /routers/web/repo/setting.go
parent4563148a61ba892e8f2bb66342f00a950bcd5315 (diff)
downloadgitea-5cb0c9aa0d7eed087055b1efca79628957207d36.tar.gz
gitea-5cb0c9aa0d7eed087055b1efca79628957207d36.zip
Propagate context and ensure git commands run in request context (#17868)
This PR continues the work in #17125 by progressively ensuring that git commands run within the request context. This now means that the if there is a git repo already open in the context it will be used instead of reopening it. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/web/repo/setting.go')
-rw-r--r--routers/web/repo/setting.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go
index b7269b6718..d1c03b59a6 100644
--- a/routers/web/repo/setting.go
+++ b/routers/web/repo/setting.go
@@ -66,7 +66,7 @@ func Settings(ctx *context.Context) {
ctx.Data["DisableNewPushMirrors"] = setting.Mirror.DisableNewPush
ctx.Data["DefaultMirrorInterval"] = setting.Mirror.DefaultInterval
- signing, _ := asymkey_service.SigningKey(ctx.Repo.Repository.RepoPath())
+ signing, _ := asymkey_service.SigningKey(ctx, ctx.Repo.Repository.RepoPath())
ctx.Data["SigningKeyAvailable"] = len(signing) > 0
ctx.Data["SigningSettings"] = setting.Repository.Signing
ctx.Data["CodeIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
@@ -221,7 +221,7 @@ func SettingsPost(ctx *context.Context) {
return
}
- if err := mirror_service.UpdateAddress(ctx.Repo.Mirror, address); err != nil {
+ if err := mirror_service.UpdateAddress(ctx, ctx.Repo.Mirror, address); err != nil {
ctx.ServerError("UpdateAddress", err)
return
}
@@ -297,7 +297,7 @@ func SettingsPost(ctx *context.Context) {
return
}
- if err = mirror_service.RemovePushMirrorRemote(m); err != nil {
+ if err = mirror_service.RemovePushMirrorRemote(ctx, m); err != nil {
ctx.ServerError("RemovePushMirrorRemote", err)
return
}
@@ -354,7 +354,7 @@ func SettingsPost(ctx *context.Context) {
return
}
- if err := mirror_service.AddPushMirrorRemote(m, address); err != nil {
+ if err := mirror_service.AddPushMirrorRemote(ctx, m, address); err != nil {
if err := repo_model.DeletePushMirrorByID(m.ID); err != nil {
log.Error("DeletePushMirrorByID %v", err)
}
@@ -578,7 +578,7 @@ func SettingsPost(ctx *context.Context) {
}
repo.IsMirror = false
- if _, err := repository.CleanUpMigrateInfo(repo); err != nil {
+ if _, err := repository.CleanUpMigrateInfo(ctx, repo); err != nil {
ctx.ServerError("CleanUpMigrateInfo", err)
return
} else if err = repo_model.DeleteMirrorByRepoID(ctx.Repo.Repository.ID); err != nil {
@@ -723,7 +723,7 @@ func SettingsPost(ctx *context.Context) {
ctx.Repo.GitRepo.Close()
}
- if err := repo_service.DeleteRepository(ctx.User, ctx.Repo.Repository, true); err != nil {
+ if err := repo_service.DeleteRepository(ctx, ctx.User, ctx.Repo.Repository, true); err != nil {
ctx.ServerError("DeleteRepository", err)
return
}
@@ -742,7 +742,7 @@ func SettingsPost(ctx *context.Context) {
return
}
- err := wiki_service.DeleteWiki(repo)
+ err := wiki_service.DeleteWiki(ctx, repo)
if err != nil {
log.Error("Delete Wiki: %v", err.Error())
}