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 ¶
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. Returns metadata about the synchronized repository, including the current commit hash.
func (*Synchronizer) SourceName ¶ added in v0.5.0
func (s *Synchronizer) SourceName() string
func (*Synchronizer) WithSecretProvider ¶ added in v0.5.0
func (s *Synchronizer) WithSecretProvider(provider pkgsync.SecretProvider) *Synchronizer
WithSecretProvider configures the synchronizer to use an external SecretProvider for authentication. This allows external projects to integrate their own secret management systems (e.g., Whisper, Vault).