git_repo

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitArchivesCacheVersion = "1"
	GitPatchesCacheVersion  = "1"
)
View Source
const GitRepoCacheVersion = "3"
View Source
const GitWorkTreeCacheVersion = "6"

Variables

This section is empty.

Functions

func GetGitRepoCacheDir

func GetGitRepoCacheDir() string

func GetWorkTreeCacheDir

func GetWorkTreeCacheDir() string

func HasSubmodulesInCommit

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

func Init added in v1.2.2

func Init() error

func ReadCommitFileAndCompareWithProjectFile added in v1.2.2

func ReadCommitFileAndCompareWithProjectFile(ctx context.Context, localGitRepo *Local, commit, projectDir, relPath string) ([]byte, 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 (*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
}

func (*Base) GetName

func (repo *Base) GetName() string

func (*Base) HeadCommit

func (repo *Base) HeadCommit(ctx context.Context) (string, error)

func (*Base) LatestBranchCommit

func (repo *Base) LatestBranchCommit(ctx context.Context, branch string) (string, error)

func (*Base) String

func (repo *Base) String() string

func (*Base) TagCommit

func (repo *Base) TagCommit(ctx context.Context, 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 GitDataManager added in v1.2.2

type GitDataManager struct {
	ArchivesCacheDir string
	PatchesCacheDir  string
	TmpDir           string
}
var (
	CommonGitDataManager *GitDataManager
)

func NewGitDataManager added in v1.2.2

func NewGitDataManager(archivesCacheDir, patchesCacheDir, tmpDir string) *GitDataManager

func (*GitDataManager) CreateArchiveFile added in v1.2.2

func (manager *GitDataManager) CreateArchiveFile(ctx context.Context, repoID string, opts ArchiveOptions, tmpPath string, desc *true_git.ArchiveDescriptor) (*ArchiveFile, error)

func (*GitDataManager) CreatePatchFile added in v1.2.2

func (manager *GitDataManager) CreatePatchFile(ctx context.Context, repoID string, opts PatchOptions, tmpPath string, desc *true_git.PatchDescriptor) (*PatchFile, error)

func (*GitDataManager) GC added in v1.2.2

func (manager *GitDataManager) GC() error

func (*GitDataManager) GetArchiveFile added in v1.2.2

func (manager *GitDataManager) GetArchiveFile(ctx context.Context, repoID string, opts ArchiveOptions) (*ArchiveFile, error)

func (*GitDataManager) GetPatchFile added in v1.2.2

func (manager *GitDataManager) GetPatchFile(ctx context.Context, repoID string, opts PatchOptions) (*PatchFile, error)

func (*GitDataManager) NewTmpFile added in v1.2.2

func (manager *GitDataManager) NewTmpFile() (string, error)

type GitRepo

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

	IsEmpty(ctx context.Context) (bool, error)
	HeadCommit(ctx context.Context) (string, error)
	LatestBranchCommit(ctx context.Context, branch string) (string, error)
	TagCommit(ctx context.Context, tag string) (string, error)
	IsCommitExists(ctx context.Context, commit string) (bool, error)
	IsAncestor(ctx context.Context, ancestorCommit, descendantCommit string) (bool, error)

	GetMergeCommitParents(ctx context.Context, commit string) ([]string, error)

	CreateDetachedMergeCommit(ctx context.Context, fromCommit, toCommit string) (string, error)
	CreatePatch(context.Context, PatchOptions) (Patch, error)
	CreateArchive(context.Context, ArchiveOptions) (Archive, error)
	Checksum(context.Context, ChecksumOptions) (Checksum, error)
}

type Local

type Local struct {
	Base
	Path   string
	GitDir string
	// contains filtered or unexported fields
}

func OpenLocalRepo

func OpenLocalRepo(name, path string, dev bool) (*Local, error)
func (repo *Local) CheckAndReadCommitSymlink(ctx context.Context, path string, commit string) (bool, []byte, error)

func (*Local) Checksum

func (repo *Local) Checksum(ctx context.Context, opts ChecksumOptions) (checksum Checksum, err error)

func (*Local) CreateArchive

func (repo *Local) CreateArchive(ctx context.Context, opts ArchiveOptions) (Archive, error)

func (*Local) CreateDetachedMergeCommit

func (repo *Local) CreateDetachedMergeCommit(ctx context.Context, fromCommit, toCommit string) (string, error)

func (*Local) CreatePatch

func (repo *Local) CreatePatch(ctx context.Context, opts PatchOptions) (Patch, error)

func (*Local) FetchOrigin added in v1.1.23

func (repo *Local) FetchOrigin(ctx context.Context) error

func (*Local) GetCommitFilePathList added in v1.2.2

func (repo *Local) GetCommitFilePathList(ctx context.Context, commit string) ([]string, error)

func (*Local) GetMergeCommitParents

func (repo *Local) GetMergeCommitParents(_ context.Context, commit string) ([]string, error)

func (*Local) HeadCommit

func (repo *Local) HeadCommit(_ context.Context) (string, error)

func (*Local) IsAncestor

func (repo *Local) IsAncestor(_ context.Context, ancestorCommit, descendantCommit string) (bool, error)

func (*Local) IsCommitDirectoryExists added in v1.2.2

func (repo *Local) IsCommitDirectoryExists(ctx context.Context, dir string, commit string) (bool, error)

func (*Local) IsCommitExists

func (repo *Local) IsCommitExists(ctx context.Context, commit string) (bool, error)

func (*Local) IsCommitFileExists added in v1.2.2

func (repo *Local) IsCommitFileExists(ctx context.Context, commit, path string) (bool, error)

func (*Local) IsEmpty

func (repo *Local) IsEmpty(ctx context.Context) (bool, error)

func (*Local) IsShallowClone

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

func (*Local) LsTree

func (repo *Local) LsTree(ctx context.Context, pathMatcher path_matcher.PathMatcher, opts LsTreeOptions) (*ls_tree.Result, error)

func (*Local) PlainOpen

func (repo *Local) PlainOpen() (*git.Repository, error)

func (*Local) ReadCommitFile added in v1.2.2

func (repo *Local) ReadCommitFile(ctx context.Context, commit, path string) ([]byte, error)

func (*Local) RemoteBranchesList

func (repo *Local) RemoteBranchesList(ctx context.Context) ([]string, error)

func (*Local) RemoteOriginUrl

func (repo *Local) RemoteOriginUrl(ctx context.Context) (string, error)

func (*Local) Status

func (repo *Local) Status(ctx context.Context, pathMatcher path_matcher.PathMatcher) (*status.Result, error)

func (*Local) SyncWithOrigin added in v1.1.23

func (repo *Local) SyncWithOrigin(ctx context.Context) error

func (*Local) TagsList

func (repo *Local) TagsList(ctx context.Context) ([]string, error)

type LsTreeOptions

type LsTreeOptions struct {
	Commit        string
	UseHeadCommit bool
	Strict        bool
}

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 (*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
	IsDryRun bool

	Endpoint *transport.Endpoint
}

func OpenRemoteRepo

func OpenRemoteRepo(name, url string) (*Remote, error)

func (*Remote) Checksum

func (repo *Remote) Checksum(ctx context.Context, opts ChecksumOptions) (checksum Checksum, err error)

func (*Remote) Clone

func (repo *Remote) Clone(ctx context.Context) (bool, error)

func (*Remote) CloneAndFetch

func (repo *Remote) CloneAndFetch(ctx context.Context) error

func (*Remote) CreateArchive

func (repo *Remote) CreateArchive(ctx context.Context, opts ArchiveOptions) (Archive, error)

func (*Remote) CreateDetachedMergeCommit

func (repo *Remote) CreateDetachedMergeCommit(ctx context.Context, fromCommit, toCommit string) (string, error)

func (*Remote) CreatePatch

func (repo *Remote) CreatePatch(ctx context.Context, opts PatchOptions) (Patch, error)

func (*Remote) Fetch

func (repo *Remote) Fetch(ctx context.Context) error

func (*Remote) GetClonePath

func (repo *Remote) GetClonePath() string

func (*Remote) GetMergeCommitParents

func (repo *Remote) GetMergeCommitParents(_ context.Context, commit string) ([]string, error)

func (*Remote) HeadCommit

func (repo *Remote) HeadCommit(_ context.Context) (string, error)

func (*Remote) IsAncestor

func (repo *Remote) IsAncestor(ctx context.Context, ancestorCommit, descendantCommit string) (bool, error)

func (*Remote) IsCommitExists

func (repo *Remote) IsCommitExists(ctx context.Context, commit string) (bool, error)

func (*Remote) IsEmpty

func (repo *Remote) IsEmpty(ctx context.Context) (bool, error)

func (*Remote) LatestBranchCommit

func (repo *Remote) LatestBranchCommit(ctx context.Context, branch string) (string, error)

func (*Remote) RemoteBranchesList

func (repo *Remote) RemoteBranchesList(_ context.Context) ([]string, error)

func (*Remote) RemoteOriginUrl

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

func (*Remote) TagCommit

func (repo *Remote) TagCommit(ctx context.Context, tag string) (string, error)

func (*Remote) TagsList

func (repo *Remote) TagsList(_ context.Context) ([]string, error)

func (*Remote) ValidateEndpoint

func (repo *Remote) ValidateEndpoint() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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