git

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommitDelimiter      string = "@sha256:"
	PullRequestReference string = "pull/([0-9]+)/head"
	SubPathDelimiter     string = "@subpath:"
)

Variables

This section is empty.

Functions

func CloneRepository

func CloneRepository(ctx context.Context, gitInfo *GitInfo, targetDir string, helper string, strictHostKeyChecking bool, log log.Logger, cloneOptions ...Option) error

func CloneRepositoryWithEnv

func CloneRepositoryWithEnv(ctx context.Context, gitInfo *GitInfo, extraEnv []string, targetDir string, helper string, strictHostKeyChecking bool, log log.Logger, cloneOptions ...Option) error

func CommandContext

func CommandContext(ctx context.Context, extraEnv []string, args ...string) *exec.Cmd

func GetBranchNameForPR

func GetBranchNameForPR(ref string) string

func GetDefaultExtraEnv

func GetDefaultExtraEnv(strictHostKeyChecking bool) []string

func GetIDForPR

func GetIDForPR(ref string) string

func InstallBinary

func InstallBinary(log log.Logger) error

func NormalizeRepository

func NormalizeRepository(str string) (string, string, string, string, string)

func PingRepository

func PingRepository(str string, extraEnv []string) bool

Types

type CloneStrategy

type CloneStrategy string
const (
	FullCloneStrategy     CloneStrategy = ""
	BloblessCloneStrategy CloneStrategy = "blobless"
	TreelessCloneStrategy CloneStrategy = "treeless"
	ShallowCloneStrategy  CloneStrategy = "shallow"
	BareCloneStrategy     CloneStrategy = "bare"
)

func (*CloneStrategy) Set

func (s *CloneStrategy) Set(v string) error

func (*CloneStrategy) String

func (s *CloneStrategy) String() string

func (*CloneStrategy) Type

func (s *CloneStrategy) Type() string

type Cloner

type Cloner interface {
	Clone(ctx context.Context, repository string, targetDir string, extraArgs, extraEnv []string, log log.Logger) error
}

func NewCloner

func NewCloner(strategy CloneStrategy) Cloner

func NewClonerWithOpts

func NewClonerWithOpts(options ...Option) Cloner

type GitInfo

type GitInfo struct {
	Repository string
	Branch     string
	Commit     string
	PR         string
	SubPath    string
}

func NewGitInfo

func NewGitInfo(repository, branch, commit, pr, subpath string) *GitInfo

func NormalizeRepositoryGitInfo

func NormalizeRepositoryGitInfo(str string) *GitInfo

type Option

type Option func(*cloner)

func WithCloneStrategy

func WithCloneStrategy(strategy CloneStrategy) Option

func WithRecursiveSubmodules

func WithRecursiveSubmodules() Option

func WithSkipLFS

func WithSkipLFS() Option

Jump to

Keyboard shortcuts

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