mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 06:21:11 +00:00 
			
		
		
		
	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>
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			823 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			823 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright 2022 The Gitea Authors. All rights reserved.
 | |
| // SPDX-License-Identifier: MIT
 | |
| 
 | |
| package convert
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 
 | |
| 	repo_model "forgejo.org/models/repo"
 | |
| 	api "forgejo.org/modules/structs"
 | |
| )
 | |
| 
 | |
| // ToPushMirror convert from repo_model.PushMirror and remoteAddress to api.TopicResponse
 | |
| func ToPushMirror(ctx context.Context, pm *repo_model.PushMirror) (*api.PushMirror, error) {
 | |
| 	repo := pm.GetRepository(ctx)
 | |
| 	return &api.PushMirror{
 | |
| 		RepoName:       repo.Name,
 | |
| 		RemoteName:     pm.RemoteName,
 | |
| 		RemoteAddress:  pm.RemoteAddress,
 | |
| 		CreatedUnix:    pm.CreatedUnix.AsTime(),
 | |
| 		LastUpdateUnix: pm.LastUpdateUnix.AsTimePtr(),
 | |
| 		LastError:      pm.LastError,
 | |
| 		Interval:       pm.Interval.String(),
 | |
| 		SyncOnCommit:   pm.SyncOnCommit,
 | |
| 		PublicKey:      pm.GetPublicKey(),
 | |
| 		BranchFilter:   pm.BranchFilter,
 | |
| 	}, nil
 | |
| }
 |