true_git

package
v1.2.319 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinGitVersionConstraintValue = "2.18"
)

Variables

View Source
var ErrCommitsNotPresent = errors.New("commits not present")
View Source
var ErrInvalidDotGit = errors.New("invalid file format: expected gitdir record")
View Source
var ForbiddenGitVersionsConstraintValues = []string{"2.22.0"}

Functions

func Archive

func Archive(ctx context.Context, out io.Writer, gitDir, workTreeCacheDir string, opts ArchiveOptions) error

func ArchiveWithSubmodules

func ArchiveWithSubmodules(ctx context.Context, out io.Writer, gitDir, workTreeCacheDir string, opts ArchiveOptions) error

func CreateDetachedMergeCommit

func CreateDetachedMergeCommit(ctx context.Context, gitDir, workTreeCacheDir, commitToMerge, mergeIntoCommit string, opts CreateDetachedMergeCommitOptions) (string, error)

func Fetch

func Fetch(ctx context.Context, path string, options FetchOptions) error

func GetLastBranchCommitSHA added in v1.2.64

func GetLastBranchCommitSHA(ctx context.Context, repoPath, branch string) (string, error)

func GitOpenWithCustomWorktreeDir

func GitOpenWithCustomWorktreeDir(gitDir, worktreeDir string) (*git.Repository, error)

func Init

func Init(ctx context.Context, opts Options) error

func IsAncestor

func IsAncestor(ctx context.Context, ancestorCommit, descendantCommit, gitDir string) (bool, error)

func IsCommitsNotPresentError added in v1.2.118

func IsCommitsNotPresentError(err error) bool

func IsShallowClone

func IsShallowClone(ctx context.Context, path string) (bool, error)

func IsShallowFileChangedSinceWeReadIt added in v1.2.170

func IsShallowFileChangedSinceWeReadIt(err error) bool

func IsValidGitDir added in v1.2.5

func IsValidGitDir(ctx context.Context, gitDir string) (bool, error)

func IsValidWorkTree added in v1.2.5

func IsValidWorkTree(ctx context.Context, workTree string) (bool, error)

func ResolveRepoDir added in v1.2.5

func ResolveRepoDir(ctx context.Context, repoDir string) (string, error)

func SyncSourceWorktreeWithServiceBranch added in v1.2.13

func SyncSourceWorktreeWithServiceBranch(ctx context.Context, gitDir, sourceWorktreeDir, worktreeCacheDir, commit string, opts SyncSourceWorktreeWithServiceBranchOptions) (string, error)

func UpwardLookupAndVerifyWorkTree added in v1.2.5

func UpwardLookupAndVerifyWorkTree(ctx context.Context, lookupPath string) (bool, string, error)

func WithWorkTree

func WithWorkTree(ctx context.Context, gitDir, workTreeCacheDir, commit string, opts WithWorkTreeOptions, f func(workTreeDir string) error) error

Types

type ArchiveOptions

type ArchiveOptions struct {
	Commit      string
	PathScope   string // Determines the directory that will get into the result (similar to <pathspec> in the git commands).
	PathMatcher path_matcher.PathMatcher
	FileRenames map[string]string // Files to rename during archiving. Git repo relative paths of original files as keys, new filenames (without base path) as values.
}

func (ArchiveOptions) ID added in v1.2.11

func (opts ArchiveOptions) ID() string

TODO: 1.3 add git mapping type (dir, file, ...) to gitArchive stage digest

type CreateDetachedMergeCommitOptions

type CreateDetachedMergeCommitOptions struct {
	HasSubmodules bool
}

type FetchOptions

type FetchOptions struct {
	All       bool
	TagsOnly  bool
	Prune     bool
	PruneTags bool
	Unshallow bool
	RefSpecs  map[string]string
}

type GitCmd added in v1.2.57

type GitCmd struct {
	*exec.Cmd

	// We always write to all of these buffs, unlike with exec.Cmd.Stdout(Stderr)
	OutBuf    *bytes.Buffer
	ErrBuf    *bytes.Buffer
	OutErrBuf *bytes.Buffer
}

func NewGitCmd added in v1.2.57

func NewGitCmd(ctx context.Context, opts *GitCmdOptions, cliArgs ...string) GitCmd

func (*GitCmd) Run added in v1.2.57

func (c *GitCmd) Run(ctx context.Context) error

type GitCmdOptions added in v1.2.57

type GitCmdOptions struct {
	RepoDir string
}

type Options

type Options struct {
	LiveGitOutput bool
}

type PatchDescriptor

type PatchDescriptor struct {
	Paths         []string
	BinaryPaths   []string
	PathsToRemove []string
}

func Patch

func Patch(ctx context.Context, out io.Writer, gitDir string, opts PatchOptions) (*PatchDescriptor, error)

func PatchWithSubmodules

func PatchWithSubmodules(ctx context.Context, out io.Writer, gitDir, workTreeCacheDir string, opts PatchOptions) (*PatchDescriptor, error)

type PatchOptions

type PatchOptions struct {
	PathScope            string // Determines the directory that will get into the result (similar to <pathspec> in the git commands).
	PathMatcher          path_matcher.PathMatcher
	FromCommit, ToCommit string
	FileRenames          map[string]string // Files to rename during patching. Git repo relative paths of original files as keys, new filenames (without base path) as values.

	WithEntireFileContext bool
	WithBinary            bool
}

func (PatchOptions) ID added in v1.2.11

func (opts PatchOptions) ID() string

type RefDescriptor

type RefDescriptor struct {
	Commit   string
	FullName string
	IsHEAD   bool

	IsTag   bool
	TagName string

	IsBranch   bool
	BranchName string
	IsRemote   bool
	RemoteName string
}

type ShowRefResult

type ShowRefResult struct {
	Refs []RefDescriptor
}

func ShowRef

func ShowRef(ctx context.Context, repoDir string) (*ShowRefResult, error)

type SyncSourceWorktreeWithServiceBranchOptions added in v1.2.13

type SyncSourceWorktreeWithServiceBranchOptions struct {
	ServiceBranch   string
	GlobExcludeList []string
}

type WithWorkTreeOptions

type WithWorkTreeOptions struct {
	HasSubmodules bool
}

type WorktreeDescriptor

type WorktreeDescriptor struct {
	Path   string
	Head   string
	Branch string
}

func GetWorkTreeList

func GetWorkTreeList(ctx context.Context, repoDir string) ([]WorktreeDescriptor, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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