git

package
v12.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrShortRef = errors.New("short SHA references are not supported")
)

Functions

func DescribeHead added in v12.5.0

func DescribeHead(ctx context.Context, repoPath string) (string, error)

DescribeHead resolves the symbolic name (tag or branch) of HEAD.

func Fetch added in v12.5.0

func Fetch(ctx context.Context, input FetchInput) error

func GetRepositoryName added in v12.5.0

func GetRepositoryName(ctx context.Context, repoPath, githubInstance, remoteName string) (string, error)

GetRepositoryName determines the name of a repository (for example, `actions/checkout`) by extracting it from the URL of the remote with the given remoteName.

func ResolveHead added in v12.5.0

func ResolveHead(ctx context.Context, repoPath string) (shortSha, sha string, err error)

ResolveHead determines the commit ID of the current HEAD.

func ResolveRevision added in v12.5.0

func ResolveRevision(ctx context.Context, repoPath, rev string) (string, error)

ResolveRevision determines the commit ID of the given revision (commit ID, tag, branch, HEAD, ...).

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 FetchInput added in v12.5.0

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

type Worktree

type Worktree interface {
	Close(ctx context.Context) error
	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