forked from gitea/gitea
Backport of #22271
This commit is contained in:
parent
75f128ebf8
commit
443fd27a90
|
@ -10,6 +10,7 @@ type CreatePushMirrorOption struct {
|
||||||
RemoteUsername string `json:"remote_username"`
|
RemoteUsername string `json:"remote_username"`
|
||||||
RemotePassword string `json:"remote_password"`
|
RemotePassword string `json:"remote_password"`
|
||||||
Interval string `json:"interval"`
|
Interval string `json:"interval"`
|
||||||
|
SyncOnCommit bool `json:"sync_on_commit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PushMirror represents information of a push mirror
|
// PushMirror represents information of a push mirror
|
||||||
|
@ -22,4 +23,5 @@ type PushMirror struct {
|
||||||
LastUpdateUnix string `json:"last_update"`
|
LastUpdateUnix string `json:"last_update"`
|
||||||
LastError string `json:"last_error"`
|
LastError string `json:"last_error"`
|
||||||
Interval string `json:"interval"`
|
Interval string `json:"interval"`
|
||||||
|
SyncOnCommit bool `json:"sync_on_commit"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,10 +346,11 @@ func CreatePushMirror(ctx *context.APIContext, mirrorOption *api.CreatePushMirro
|
||||||
}
|
}
|
||||||
|
|
||||||
pushMirror := &repo_model.PushMirror{
|
pushMirror := &repo_model.PushMirror{
|
||||||
RepoID: repo.ID,
|
RepoID: repo.ID,
|
||||||
Repo: repo,
|
Repo: repo,
|
||||||
RemoteName: fmt.Sprintf("remote_mirror_%s", remoteSuffix),
|
RemoteName: fmt.Sprintf("remote_mirror_%s", remoteSuffix),
|
||||||
Interval: interval,
|
Interval: interval,
|
||||||
|
SyncOnCommit: mirrorOption.SyncOnCommit,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = repo_model.InsertPushMirror(ctx, pushMirror); err != nil {
|
if err = repo_model.InsertPushMirror(ctx, pushMirror); err != nil {
|
||||||
|
|
|
@ -14831,6 +14831,10 @@
|
||||||
"remote_username": {
|
"remote_username": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "RemoteUsername"
|
"x-go-name": "RemoteUsername"
|
||||||
|
},
|
||||||
|
"sync_on_commit": {
|
||||||
|
"type": "boolean",
|
||||||
|
"x-go-name": "SyncOnCommit"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||||
|
@ -18011,6 +18015,10 @@
|
||||||
"repo_name": {
|
"repo_name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"x-go-name": "RepoName"
|
"x-go-name": "RepoName"
|
||||||
|
},
|
||||||
|
"sync_on_commit": {
|
||||||
|
"type": "boolean",
|
||||||
|
"x-go-name": "SyncOnCommit"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||||
|
|
Loading…
Reference in New Issue