Documentation
¶
Overview ¶
gitsync package implements Git synchronization. It maintains a local filesystem copy for each configured git reference. This package implements no threadpooling, it is expected that the caller will handle concurrency and parallelism. The Synchronizer is not thread-safe.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Synchronizer ¶
type Synchronizer struct {
// contains filtered or unexported fields
}
func New ¶
func New(path string, config config.Git, sourceName string) *Synchronizer
New creates a new Synchronizer instance. It is expected the threadpooling is outside of this package. The synchronizer does not validate the path holds the same repository as the config. Therefore, the caller should guarantee that the path is unique for each repository and that the path is not used by multiple Synchronizer instances. If the path does not exist, it will be created.
func (*Synchronizer) Close ¶
func (*Synchronizer) Close(context.Context)
func (*Synchronizer) Execute ¶
func (s *Synchronizer) Execute(ctx context.Context) error
Execute performs the synchronization of the configured Git repository. If the repository does not exist on disk, clone it. If it does exist, pull the latest changes and rebase the local branch onto the remote branch.