aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorChongyi Zheng <harry@harryzheng.com>2022-12-30 06:22:51 -0500
committerGitHub <noreply@github.com>2022-12-30 19:22:51 +0800
commit9dcaf14a148fdf748c41afc7e0aa2e6b3b273fd8 (patch)
tree9a034ae09943f7a71198e286ffc0cffc27dcd9df /routers/api
parentb76970f2e45d04d363fd6897439f111db24e4bca (diff)
downloadgitea-9dcaf14a148fdf748c41afc7e0aa2e6b3b273fd8.tar.gz
gitea-9dcaf14a148fdf748c41afc7e0aa2e6b3b273fd8.zip
Add `sync_on_commit` option for push mirrors api (#22271)
Push mirrors `sync_on_commit` option was added to the web interface in v1.18.0. However, it's not added to the API. This PR updates the API endpoint. Fixes #22267 Also, I think this should be backported to 1.18
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/mirror.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/routers/api/v1/repo/mirror.go b/routers/api/v1/repo/mirror.go
index 5fce5a4a80..06bfabe3d2 100644
--- a/routers/api/v1/repo/mirror.go
+++ b/routers/api/v1/repo/mirror.go
@@ -345,10 +345,11 @@ func CreatePushMirror(ctx *context.APIContext, mirrorOption *api.CreatePushMirro
}
pushMirror := &repo_model.PushMirror{
- RepoID: repo.ID,
- Repo: repo,
- RemoteName: fmt.Sprintf("remote_mirror_%s", remoteSuffix),
- Interval: interval,
+ RepoID: repo.ID,
+ Repo: repo,
+ RemoteName: fmt.Sprintf("remote_mirror_%s", remoteSuffix),
+ Interval: interval,
+ SyncOnCommit: mirrorOption.SyncOnCommit,
}
if err = repo_model.InsertPushMirror(ctx, pushMirror); err != nil {