target

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: 12 Imported by: 0

Documentation

Overview

Package target provides a representation of local repositories, i.e. mirror targets.

Index

Constants

View Source
const (
	// DefaultRemote is the name of the remote used for sources.
	DefaultRemote = "origin"

	// GitDirName is the name of the gitdir folder inside a repo's workdir.
	GitDirName = ".git"
)

Variables

This section is empty.

Functions

func IsBare

func IsBare(tgt Target) bool

IsBare returns true iff the input target does not have a work directory.

Types

type Target

type Target interface {
	// Path to local gitdir (not working tree).
	GitDir() fspath.Local
	// WorkDir is the rep's working directory, or empty if the repo is bare.
	WorkDir() fspath.Local
	// LastUpdatedAt is the most recent time at which a remote reference was updated. May be zero.
	RemoteLastUpdatedAt() time.Time
}

Target is a local copy of a repository (mirror target).

func Find

func Find(root fspath.Local) ([]Target, error)

Find walks the filesystem to find all repository targets under the root. Nested git directories are ignored. The root directory is never considered a valid repository.

func FromPath

func FromPath(dpath fspath.Local) (Target, error)

FromPath returns a Target from a local path if it contains a repository. Otherwise it returns a nil target.

Jump to

Keyboard shortcuts

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