git

package
v12.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrShortRef = errors.New("short SHA references are not supported")
	ErrNoRepo   = errors.New("unable to find git repo")
)

Functions

func FindGitRef

func FindGitRef(ctx context.Context, file string) (string, error)

FindGitRef get the current git ref

func FindGitRevision

func FindGitRevision(ctx context.Context, file string) (shortSha, sha string, err error)

FindGitRevision get the current git revision

func FindGithubRepo

func FindGithubRepo(ctx context.Context, file, githubInstance, remoteName string) (string, error)

FindGithubRepo get the repo

Types

type CloneInput

type CloneInput struct {
	CacheDir        string // parent-location for all git caches that the runner maintains
	URL             string // url of the remote to clone
	Ref             string // reference from the remote; eg. tag, branch, or sha
	Token           string // authentication token
	OfflineMode     bool   // when true, no remote operations will occur
	InsecureSkipTLS bool   // when true, TLS verification will be skipped on remote operations
}

CloneInput is a parameter struct for the method `Clone` to simplify the multiple parameters required.

type Error

type Error struct {
	// contains filtered or unexported fields
}

func (*Error) Commit

func (e *Error) Commit() string

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Worktree

type Worktree interface {
	io.Closer
	WorktreeDir() string // fully qualified path to the work tree for this repo
}

func Clone

func Clone(ctx context.Context, input CloneInput) (Worktree, error)

Clones a git repo. The repo contents are stored opaquely in the provided `CacheDir`, and may be reused by future clone operations. The returned value contains a path to the working tree that can be used to interact with the requested ref; it must be closed to indicate operations against it are complete.

Jump to

Keyboard shortcuts

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