gitfetcher

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package gitfetcher creates local mirrors from remote git repositories.

Index

Constants

This section is empty.

Variables

View Source
var (
	FindTargets = target.Find
	LoadSources = source.Load
)

Reexports.

Functions

func FindConfig added in v0.13.0

func FindConfig(dpath fspath.Local) (*configpb.Config, error)

FindConfig locates the first configuration file named .gitfetcher.conf starting from dpath and going up the filesystem hierarchy. If no such file is found, a default configuration is returned with root set to dpath.

func ReadConfig added in v0.13.0

func ReadConfig(fpath fspath.Local) (*configpb.Config, error)

ReadConfig parses a configuration file from fpath.

Types

type Config

type Config = configpb.Config

Config is the generated configuration type, exported here for use in helper signatures.

type SyncStatus added in v0.3.0

type SyncStatus int

SyncStatus captures possible states of the local repository vs its remote.

const (
	// Not enough information.
	SyncStatusUnknown SyncStatus = iota
	// No local copy of the repository.
	SyncStatusMissing
	// A local copy of the repository exists but is not up-to-date.
	SyncStatusStale
	// The local copy of the repository exists and is up-to-date.
	SyncStatusFresh
)

type Syncable added in v0.13.0

type Syncable struct {
	// Absolute local path to the repository's gitdir.
	GitDir fspath.Local
	// contains filtered or unexported fields
}

Syncable contains all the information needed to mirror a repository.

func GatherSyncables added in v0.13.0

func GatherSyncables(
	targets []target.Target,
	sources []source.Source,
	root string,
	initLayout configpb.Options_Layout,
) ([]Syncable, error)

GatherSyncables reconciles targets and sources into Syncable instances.

func (*Syncable) LastSyncedAt added in v0.13.0

func (s *Syncable) LastSyncedAt() time.Time

LastSyncedAt returns the time at which the repo's origin remote was last updated, or zero if the repo does not exist locally.

func (*Syncable) RootDir added in v0.13.0

func (s *Syncable) RootDir() fspath.Local

RootDir returns the syncable's outermost directory (workdir if present, else gitdir).

func (*Syncable) Sync added in v0.13.0

func (s *Syncable) Sync(ctx context.Context) (err error)

Sync syncs local copies in the root folder of each source. Missing local repositories will be created, others will be updated as needed.

func (*Syncable) SyncStatus added in v0.13.0

func (s *Syncable) SyncStatus() SyncStatus

SyncStatus returns the current SyncStatus of the syncable.

func (*Syncable) WorkDir added in v0.13.0

func (s *Syncable) WorkDir() fspath.Local

WorkDir returns the syncable's working directory, or an empty string if absent (for bare repos).

Directories

Path Synopsis
Package fspath enables more explicit type signatures for filesystem paths.
Package fspath enables more explicit type signatures for filesystem paths.
Package target provides a representation of local repositories, i.e.
Package target provides a representation of local repositories, i.e.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL