true_git

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinGitVersionConstraint               = "1.9.0"
	MinGitVersionWithSubmodulesConstraint = "2.14.0"
)

Variables

View Source
var (
	GitVersion            string
	RequiredGitVersionMsg = fmt.Sprintf("Git version >= %s required! To use submodules install git >= %s.", MinGitVersionConstraint, MinGitVersionWithSubmodulesConstraint)
)

Functions

func Init

func Init(opts Options) error

func IsFileInBasePath

func IsFileInBasePath(filePath, basePath string) bool

* basePath can be path to a directory or a file.

func IsFilePathMatchesOneOfPatterns

func IsFilePathMatchesOneOfPatterns(filePath string, patterns []string) bool

func IsFilePathMatchesPattern

func IsFilePathMatchesPattern(filePath, pattern string) bool

func IsFilePathValid

func IsFilePathValid(filePath, basePath string, includePaths, excludePaths []string) bool

func NormalizeAbsolutePath

func NormalizeAbsolutePath(path string) string

func NormalizeDirectoryPrefix

func NormalizeDirectoryPrefix(directoryPrefix string) string

func PrepareWorkTree

func PrepareWorkTree(gitDir, workTreeDir string, commit string) error

func PrepareWorkTreeWithSubmodules

func PrepareWorkTreeWithSubmodules(gitDir, workTreeDir string, commit string) error

func TrimFileBasePath

func TrimFileBasePath(filePath, basePath string) string

Types

type ArchiveDescriptor

type ArchiveDescriptor struct {
	Type    ArchiveType
	IsEmpty bool
}

func Archive

func Archive(out io.Writer, gitDir, workTreeDir string, opts ArchiveOptions) (*ArchiveDescriptor, error)

func ArchiveWithSubmodules

func ArchiveWithSubmodules(out io.Writer, gitDir, workTreeDir string, opts ArchiveOptions) (*ArchiveDescriptor, error)

type ArchiveOptions

type ArchiveOptions struct {
	Commit     string
	PathFilter PathFilter
}

type ArchiveType

type ArchiveType string
const (
	FileArchive      ArchiveType = "file"
	DirectoryArchive ArchiveType = "directory"
)

type Options

type Options struct {
	Out, Err io.Writer
}

type PatchDescriptor

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

func Patch

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

func PatchWithSubmodules

func PatchWithSubmodules(out io.Writer, gitDir, workTreeDir string, opts PatchOptions) (*PatchDescriptor, error)

type PatchOptions

type PatchOptions struct {
	FromCommit, ToCommit string
	PathFilter           PathFilter

	WithEntireFileContext bool
	WithBinary            bool
}

type PathFilter

type PathFilter struct {
	// BasePath can be path to the directory or a single file
	BasePath                   string
	IncludePaths, ExcludePaths []string
}

func (*PathFilter) IsFilePathValid

func (f *PathFilter) IsFilePathValid(filePath string) bool

func (*PathFilter) String

func (f *PathFilter) String() string

func (*PathFilter) TrimFileBasePath

func (f *PathFilter) TrimFileBasePath(filePath string) string

Jump to

Keyboard shortcuts

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