git

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 21 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloneToBucketOptions

type CloneToBucketOptions struct {
	Mapper            storage.Mapper
	Name              Name
	RecurseSubmodules bool
}

CloneToBucketOptions are options for Clone.

type Cloner

type Cloner interface {
	// CloneToBucket clones the repository to the bucket.
	//
	// The url must contain the scheme, including file:// if necessary.
	// depth must be > 0.
	CloneToBucket(
		ctx context.Context,
		envContainer app.EnvContainer,
		url string,
		depth uint32,
		writeBucket storage.WriteBucket,
		options CloneToBucketOptions,
	) error
}

Cloner clones git repositories to buckets.

func NewCloner

func NewCloner(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
	runner command.Runner,
	options ClonerOptions,
) Cloner

NewCloner returns a new Cloner.

type ClonerOptions

type ClonerOptions struct {
	HTTPSUsernameEnvKey      string
	HTTPSPasswordEnvKey      string
	SSHKeyFileEnvKey         string
	SSHKnownHostsFilesEnvKey string
}

ClonerOptions are options for a new Cloner.

type ListFilesAndUnstagedFilesOptions added in v1.14.0

type ListFilesAndUnstagedFilesOptions struct {
	// IgnorePathRegexps are regexes of paths to ignore.
	//
	// These must be unnormalized in the manner of the local OS that the Lister
	// is being applied to.
	IgnorePathRegexps []*regexp.Regexp
}

ListFilesAndUnstagedFilesOptions are options for ListFilesAndUnstagedFiles.

type Lister added in v1.14.0

type Lister interface {
	// ListFilesAndUnstagedFiles lists all files checked into git except those that
	// were deleted, and also lists unstaged files.
	//
	// This does not list unstaged deleted files
	// This does not list unignored files that were not added.
	// This ignores regular files.
	//
	// This is used for situations like license headers where we want all the
	// potential git files during development.
	//
	// The returned paths will be unnormalized.
	//
	// This is the equivalent of doing:
	//
	//	comm -23 \
	//		<(git ls-files --cached --modified --others --no-empty-directory --exclude-standard | sort -u | grep -v -e IGNORE_PATH1 -e IGNORE_PATH2) \
	//		<(git ls-files --deleted | sort -u)
	ListFilesAndUnstagedFiles(
		ctx context.Context,
		envContainer app.EnvStdioContainer,
		options ListFilesAndUnstagedFilesOptions,
	) ([]string, error)
}

Lister lists files in git repositories.

func NewLister added in v1.14.0

func NewLister(runner command.Runner) Lister

NewLister returns a new Lister.

type Name

type Name interface {
	// contains filtered or unexported methods
}

Name is a name identifiable by git.

func NewBranchName

func NewBranchName(branch string) Name

NewBranchName returns a new Name for the branch.

func NewRefName

func NewRefName(ref string) Name

NewRefName returns a new Name for the ref.

func NewRefNameWithBranch

func NewRefNameWithBranch(ref string, branch string) Name

NewRefNameWithBranch returns a new Name for the ref while setting branch as the clone target.

func NewTagName

func NewTagName(tag string) Name

NewTagName returns a new Name for the tag.

Directories

Path Synopsis
cmd
git-ls-files-unstaged
Package main implements a file lister for git that lists unstaged files.
Package main implements a file lister for git that lists unstaged files.

Jump to

Keyboard shortcuts

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