1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-02 16:35:19 +02:00

feat: add configuration to only push mirror selected branches (#7823)

Adds the ability to selectively choose which branches are pushed to a mirror.

This change adds an additional text box on the repository settings for each push mirror. Existing behavior is preserved when the field is left blank.

When the repository is being pushed, only branches matching the comma separated branch filter are pushed.

Resolves forgejo/forgejo#7242

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7823
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Paul Campbell <pcampbell@kemitix.net>
Co-committed-by: Paul Campbell <pcampbell@kemitix.net>
This commit is contained in:
Paul Campbell 2025-07-12 00:39:35 +02:00 committed by Gusted
parent 0b74ecebe0
commit 9dfdacf54f
16 changed files with 1089 additions and 10 deletions

View file

@ -32,6 +32,7 @@ type PushMirror struct {
Repo *Repository `xorm:"-"`
RemoteName string
RemoteAddress string `xorm:"VARCHAR(2048)"`
BranchFilter string `xorm:"VARCHAR(2048)"`
// A keypair formatted in OpenSSH format.
PublicKey string `xorm:"VARCHAR(100)"`
@ -122,6 +123,11 @@ func UpdatePushMirrorInterval(ctx context.Context, m *PushMirror) error {
return err
}
func UpdatePushMirrorBranchFilter(ctx context.Context, m *PushMirror) error {
_, err := db.GetEngine(ctx).ID(m.ID).Cols("branch_filter").Update(m)
return err
}
var DeletePushMirrors = deletePushMirrors
func deletePushMirrors(ctx context.Context, opts PushMirrorOptions) error {