git_repo

package
v1.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const GIT_WORKTREE_CACHE_VERSION = "1"
View Source
const RemoteGitRepoCacheVersion = 4

Variables

This section is empty.

Functions

func GetBaseWorkTreeDir

func GetBaseWorkTreeDir() string

func HasSubmodulesInCommit

func HasSubmodulesInCommit(commit *object.Commit) (bool, error)

Types

type Archive

type Archive interface {
	GetFilePath() string
	GetType() ArchiveType
	IsEmpty() bool
}

type ArchiveFile

type ArchiveFile struct {
	FilePath   string
	Descriptor *true_git.ArchiveDescriptor
}

func NewTmpArchiveFile

func NewTmpArchiveFile() *ArchiveFile

func (*ArchiveFile) GetFilePath

func (a *ArchiveFile) GetFilePath() string

func (*ArchiveFile) GetType

func (a *ArchiveFile) GetType() ArchiveType

func (*ArchiveFile) IsEmpty

func (a *ArchiveFile) IsEmpty() bool

type ArchiveOptions

type ArchiveOptions struct {
	FilterOptions
	Commit string
}

type ArchiveType

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

type Base

type Base struct {
	Name   string
	TmpDir string
}

func (*Base) GetName

func (repo *Base) GetName() string

func (*Base) HeadCommit

func (repo *Base) HeadCommit() (string, error)

func (*Base) LatestBranchCommit

func (repo *Base) LatestBranchCommit(branch string) (string, error)

func (*Base) String

func (repo *Base) String() string

func (*Base) TagCommit

func (repo *Base) TagCommit(branch string) (string, error)

type Checksum

type Checksum interface {
	String() string
	GetNoMatchPaths() []string
}

type ChecksumDescriptor

type ChecksumDescriptor struct {
	NoMatchPaths []string
	Hash         hash.Hash
}

func (*ChecksumDescriptor) GetNoMatchPaths

func (c *ChecksumDescriptor) GetNoMatchPaths() []string

func (*ChecksumDescriptor) String

func (c *ChecksumDescriptor) String() string

type ChecksumOptions

type ChecksumOptions struct {
	FilterOptions
	Paths  []string
	Commit string
}

type FilterOptions

type FilterOptions struct {
	BasePath                   string
	IncludePaths, ExcludePaths []string
}

type GitRepo

type GitRepo interface {
	String() string
	GetName() string

	IsEmpty() (bool, error)
	HeadCommit() (string, error)
	LatestBranchCommit(branch string) (string, error)
	TagCommit(tag string) (string, error)
	IsCommitExists(commit string) (bool, error)
	FindCommitIdByMessage(regex string) (string, error)

	CreatePatch(PatchOptions) (Patch, error)
	CreateArchive(ArchiveOptions) (Archive, error)
	Checksum(ChecksumOptions) (Checksum, error)
}

TODO: This is interface for build pkg only -- should be renamed. Do not add operations that are not designed for build pkg usage.

type Local

type Local struct {
	Base
	Path   string
	GitDir string
}

func (*Local) Checksum

func (repo *Local) Checksum(opts ChecksumOptions) (Checksum, error)

func (*Local) CreateArchive

func (repo *Local) CreateArchive(opts ArchiveOptions) (Archive, error)

func (*Local) CreatePatch

func (repo *Local) CreatePatch(opts PatchOptions) (Patch, error)

func (*Local) FindCommitIdByMessage

func (repo *Local) FindCommitIdByMessage(regex string) (string, error)

func (*Local) GetCurrentBranchName

func (repo *Local) GetCurrentBranchName() string

func (*Local) GetCurrentTagName

func (repo *Local) GetCurrentTagName() string

func (*Local) GetHeadCommit

func (repo *Local) GetHeadCommit() string

func (*Local) HeadBranchName

func (repo *Local) HeadBranchName() (string, error)

func (*Local) HeadCommit

func (repo *Local) HeadCommit() (string, error)

func (*Local) IsBranchState

func (repo *Local) IsBranchState() bool

func (*Local) IsCommitExists

func (repo *Local) IsCommitExists(commit string) (bool, error)

func (*Local) IsEmpty

func (repo *Local) IsEmpty() (bool, error)

func (*Local) IsTagState

func (repo *Local) IsTagState() bool

func (*Local) RemoteBranchesList

func (repo *Local) RemoteBranchesList() ([]string, error)

func (*Local) RemoteOriginUrl

func (repo *Local) RemoteOriginUrl() (string, error)

func (*Local) TagsList

func (repo *Local) TagsList() ([]string, error)

type Patch

type Patch interface {
	GetFilePath() string
	IsEmpty() bool
	HasBinary() bool
	GetPaths() []string
	GetBinaryPaths() []string
}

type PatchFile

type PatchFile struct {
	FilePath   string
	Descriptor *true_git.PatchDescriptor
}

func NewTmpPatchFile

func NewTmpPatchFile() *PatchFile

func (*PatchFile) GetBinaryPaths

func (p *PatchFile) GetBinaryPaths() []string

func (*PatchFile) GetFilePath

func (p *PatchFile) GetFilePath() string

func (*PatchFile) GetPaths

func (p *PatchFile) GetPaths() []string

func (*PatchFile) HasBinary

func (p *PatchFile) HasBinary() bool

func (*PatchFile) IsEmpty

func (p *PatchFile) IsEmpty() bool

type PatchOptions

type PatchOptions struct {
	FilterOptions
	FromCommit, ToCommit string

	WithEntireFileContext bool
	WithBinary            bool
}

type Remote

type Remote struct {
	Base
	Url       string
	ClonePath string // TODO: move CacheVersion & path construction here
	IsDryRun  bool
}

func (*Remote) Checksum

func (repo *Remote) Checksum(opts ChecksumOptions) (Checksum, error)

func (*Remote) Clone

func (repo *Remote) Clone() (bool, error)

func (*Remote) CloneAndFetch

func (repo *Remote) CloneAndFetch() error

func (*Remote) CreateArchive

func (repo *Remote) CreateArchive(opts ArchiveOptions) (Archive, error)

func (*Remote) CreatePatch

func (repo *Remote) CreatePatch(opts PatchOptions) (Patch, error)

func (*Remote) Fetch

func (repo *Remote) Fetch() error

func (*Remote) FindCommitIdByMessage

func (repo *Remote) FindCommitIdByMessage(regex string) (string, error)

func (*Remote) HeadBranchName

func (repo *Remote) HeadBranchName() (string, error)

func (*Remote) HeadCommit

func (repo *Remote) HeadCommit() (string, error)

func (*Remote) IsCommitExists

func (repo *Remote) IsCommitExists(commit string) (bool, error)

func (*Remote) IsEmpty

func (repo *Remote) IsEmpty() (bool, error)

func (*Remote) LatestBranchCommit

func (repo *Remote) LatestBranchCommit(branch string) (string, error)

func (*Remote) RemoteBranchesList

func (repo *Remote) RemoteBranchesList() ([]string, error)

func (*Remote) RemoteOriginUrl

func (repo *Remote) RemoteOriginUrl() (string, error)

func (*Remote) TagCommit

func (repo *Remote) TagCommit(tag string) (string, error)

func (*Remote) TagsList

func (repo *Remote) TagsList() ([]string, error)

Jump to

Keyboard shortcuts

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