Documentation ¶
Index ¶
- Constants
- Variables
- func GetGitRepoCacheDir() string
- func GetWorkTreeCacheDir() string
- func HasSubmodulesInCommit(commit *object.Commit) (bool, error)
- func Init() error
- func IsTreeEntryNotFoundInRepoErr(err error) bool
- type Archive
- type ArchiveFile
- type ArchiveOptions
- type ArchiveType
- type Base
- func (repo *Base) CreateArchive(ctx context.Context, repoPath, gitDir, repoID, workTreeCacheDir string, ...) (archive Archive, err error)
- func (repo *Base) CreateChecksum(ctx context.Context, ...) (checksum Checksum, err error)
- func (repo *Base) CreatePatch(ctx context.Context, repoPath, gitDir, repoID, workTreeCacheDir string, ...) (patch Patch, err error)
- func (repo *Base) GetName() string
- func (repo *Base) HeadCommit(ctx context.Context) (string, error)
- func (repo *Base) LatestBranchCommit(ctx context.Context, branch string) (string, error)
- func (repo *Base) String() string
- func (repo *Base) TagCommit(ctx context.Context, branch string) (string, error)
- type Cache
- type Checksum
- type ChecksumDescriptor
- type ChecksumOptions
- type FilterOptions
- type GitDataManager
- func (manager *GitDataManager) CreateArchiveFile(ctx context.Context, repoID string, opts ArchiveOptions, tmpPath string, ...) (*ArchiveFile, error)
- func (manager *GitDataManager) CreatePatchFile(ctx context.Context, repoID string, opts PatchOptions, tmpPath string, ...) (*PatchFile, error)
- func (manager *GitDataManager) GC() error
- func (manager *GitDataManager) GetArchiveFile(ctx context.Context, repoID string, opts ArchiveOptions) (*ArchiveFile, error)
- func (manager *GitDataManager) GetPatchFile(ctx context.Context, repoID string, opts PatchOptions) (*PatchFile, error)
- func (manager *GitDataManager) NewTmpFile() (string, error)
- type GitRepo
- type Local
- func (repo *Local) CreateDetachedMergeCommit(ctx context.Context, fromCommit, toCommit string) (string, error)
- func (repo *Local) FetchOrigin(ctx context.Context) error
- func (repo *Local) GetMergeCommitParents(_ context.Context, commit string) ([]string, error)
- func (repo *Local) GetOrCreateArchive(ctx context.Context, opts ArchiveOptions) (Archive, error)
- func (repo *Local) GetOrCreateChecksum(ctx context.Context, opts ChecksumOptions) (checksum Checksum, checksumErr error)
- func (repo *Local) GetOrCreatePatch(ctx context.Context, opts PatchOptions) (Patch, error)
- func (repo *Local) HeadCommit(_ context.Context) (string, error)
- func (repo *Local) IsAncestor(_ context.Context, ancestorCommit, descendantCommit string) (bool, error)
- func (repo *Local) IsCommitDirectoryExist(ctx context.Context, commit, path string) (exist bool, err error)
- func (repo *Local) IsCommitExists(ctx context.Context, commit string) (bool, error)
- func (repo *Local) IsCommitFileExist(ctx context.Context, commit, path string) (exist bool, err error)
- func (repo *Local) IsCommitTreeEntryDirectory(ctx context.Context, commit, relPath string) (isDirectory bool, err error)
- func (repo *Local) IsCommitTreeEntryExist(ctx context.Context, commit, relPath string) (exist bool, err error)
- func (repo *Local) IsEmpty(ctx context.Context) (bool, error)
- func (repo *Local) IsShallowClone() (bool, error)
- func (repo *Local) ListCommitFilesWithGlob(ctx context.Context, commit string, dir string, glob string) (files []string, err error)
- func (repo *Local) LsTree(ctx context.Context, pathMatcher path_matcher.PathMatcher, opts LsTreeOptions) (*ls_tree.Result, error)
- func (repo *Local) PlainOpen() (*git.Repository, error)
- func (repo *Local) ReadCommitFile(ctx context.Context, commit, path string) (data []byte, err error)
- func (repo *Local) ReadCommitTreeEntryContent(ctx context.Context, commit, relPath string) ([]byte, error)
- func (repo *Local) RemoteBranchesList(_ context.Context) ([]string, error)
- func (repo *Local) RemoteOriginUrl(_ context.Context) (string, error)
- func (repo *Local) ResolveAndCheckCommitFilePath(ctx context.Context, commit, path string, ...) (resolvedPath string, err error)
- func (repo *Local) ResolveCommitFilePath(ctx context.Context, commit, path string) (resolvedPath string, err error)
- func (repo *Local) StatusPathList(ctx context.Context, pathMatcher path_matcher.PathMatcher, ...) (list []string, err error)
- func (repo *Local) SyncWithOrigin(ctx context.Context) error
- func (repo *Local) TagsList(_ context.Context) ([]string, error)
- func (repo *Local) ValidateSubmodules(ctx context.Context, pathMatcher path_matcher.PathMatcher, ...) error
- func (repo *Local) WalkCommitFiles(ctx context.Context, commit string, dir string, ...) error
- type LsTreeOptions
- type OpenLocalRepoOptions
- type Patch
- type PatchFile
- type PatchOptions
- type Remote
- func (repo *Remote) Clone(ctx context.Context) (bool, error)
- func (repo *Remote) CloneAndFetch(ctx context.Context) error
- func (repo *Remote) CreateDetachedMergeCommit(ctx context.Context, fromCommit, toCommit string) (string, error)
- func (repo *Remote) Fetch(ctx context.Context) error
- func (repo *Remote) GetClonePath() string
- func (repo *Remote) GetMergeCommitParents(_ context.Context, commit string) ([]string, error)
- func (repo *Remote) GetOrCreateArchive(ctx context.Context, opts ArchiveOptions) (Archive, error)
- func (repo *Remote) GetOrCreateChecksum(ctx context.Context, opts ChecksumOptions) (Checksum, error)
- func (repo *Remote) GetOrCreatePatch(ctx context.Context, opts PatchOptions) (Patch, error)
- func (repo *Remote) HeadCommit(_ context.Context) (string, error)
- func (repo *Remote) IsAncestor(ctx context.Context, ancestorCommit, descendantCommit string) (bool, error)
- func (repo *Remote) IsCommitExists(ctx context.Context, commit string) (bool, error)
- func (repo *Remote) IsEmpty(ctx context.Context) (bool, error)
- func (repo *Remote) LatestBranchCommit(ctx context.Context, branch string) (string, error)
- func (repo *Remote) RemoteBranchesList(_ context.Context) ([]string, error)
- func (repo *Remote) RemoteOriginUrl() (string, error)
- func (repo *Remote) TagCommit(ctx context.Context, tag string) (string, error)
- func (repo *Remote) TagsList(_ context.Context) ([]string, error)
- func (repo *Remote) ValidateEndpoint() error
- type StatusPathListOptions
- type SubmoduleAddedAndNotCommittedError
- type SubmoduleCommitChangedError
- type SubmoduleDeletedError
- type SubmoduleErrorBase
- type SubmoduleHasUncommittedChangesError
- type SubmoduleHasUntrackedChangesError
- type ValidateSubmodulesOptions
Constants ¶
const ( GitArchivesCacheVersion = "2" GitPatchesCacheVersion = "2" )
const GitRepoCacheVersion = "4"
const GitWorkTreeCacheVersion = "8"
Variables ¶
var ErrLocalRepositoryNotExists = git.ErrRepositoryNotExists
Functions ¶
func GetGitRepoCacheDir ¶
func GetGitRepoCacheDir() string
func GetWorkTreeCacheDir ¶
func GetWorkTreeCacheDir() string
func IsTreeEntryNotFoundInRepoErr ¶ added in v1.2.5
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 ¶
func (*Base) CreateArchive ¶ added in v1.2.6
func (*Base) CreateChecksum ¶ added in v1.2.6
func (*Base) CreatePatch ¶ added in v1.2.6
func (*Base) LatestBranchCommit ¶
type ChecksumDescriptor ¶
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 GitDataManager ¶ added in v1.2.2
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) GetOrCreatePatch(context.Context, PatchOptions) (Patch, error) GetOrCreateArchive(context.Context, ArchiveOptions) (Archive, error) GetOrCreateChecksum(context.Context, ChecksumOptions) (Checksum, error) }
type Local ¶
type Local struct { Base WorkTreeDir string GitDir string // contains filtered or unexported fields }
func OpenLocalRepo ¶
func OpenLocalRepo(name, workTreeDir string, opts OpenLocalRepoOptions) (l *Local, err error)
func (*Local) CreateDetachedMergeCommit ¶
func (*Local) FetchOrigin ¶ added in v1.1.23
func (*Local) GetMergeCommitParents ¶
func (*Local) GetOrCreateArchive ¶ added in v1.2.6
func (*Local) GetOrCreateChecksum ¶ added in v1.2.6
func (*Local) GetOrCreatePatch ¶ added in v1.2.6
func (*Local) IsAncestor ¶
func (*Local) IsCommitDirectoryExist ¶ added in v1.2.5
func (repo *Local) IsCommitDirectoryExist(ctx context.Context, commit, path string) (exist bool, err error)
IsCommitDirectoryExist resolves symlinks and returns true if the resolved commit tree entry is Dir or Submodule.
func (*Local) IsCommitExists ¶
func (*Local) IsCommitFileExist ¶ added in v1.2.5
func (repo *Local) IsCommitFileExist(ctx context.Context, commit, path string) (exist bool, err error)
IsCommitFileExist resolves symlinks and returns true if the resolved commit tree entry is Regular, Deprecated, or Executable.
func (*Local) IsCommitTreeEntryDirectory ¶ added in v1.2.7
func (*Local) IsCommitTreeEntryExist ¶ added in v1.2.5
func (*Local) IsShallowClone ¶
func (*Local) ListCommitFilesWithGlob ¶ added in v1.2.5
func (repo *Local) ListCommitFilesWithGlob(ctx context.Context, commit string, dir string, glob string) (files []string, err error)
ListCommitFilesWithGlob returns the list of files by the glob, follows symlinks. The result paths are relative to the passed directory, the method does reverse resolving for symlinks.
func (*Local) LsTree ¶
func (repo *Local) LsTree(ctx context.Context, pathMatcher path_matcher.PathMatcher, opts LsTreeOptions) (*ls_tree.Result, error)
func (*Local) ReadCommitFile ¶ added in v1.2.2
func (repo *Local) ReadCommitFile(ctx context.Context, commit, path string) (data []byte, err error)
ReadCommitFile resolves symlinks and returns commit tree entry content.
func (*Local) ReadCommitTreeEntryContent ¶ added in v1.2.5
func (*Local) RemoteBranchesList ¶
func (*Local) RemoteOriginUrl ¶
func (*Local) ResolveAndCheckCommitFilePath ¶ added in v1.2.5
func (repo *Local) ResolveAndCheckCommitFilePath(ctx context.Context, commit, path string, checkSymlinkTargetFunc func(resolvedPath string) error) (resolvedPath string, err error)
ResolveAndCheckCommitFilePath does ResolveCommitFilePath with an additional check for each resolved link target.
func (*Local) ResolveCommitFilePath ¶ added in v1.2.5
func (repo *Local) ResolveCommitFilePath(ctx context.Context, commit, path string) (resolvedPath string, err error)
ResolveCommitFilePath follows symbolic links and returns the resolved path if there is a corresponding tree entry in the repo.
func (*Local) StatusPathList ¶ added in v1.2.8
func (repo *Local) StatusPathList(ctx context.Context, pathMatcher path_matcher.PathMatcher, opts StatusPathListOptions) (list []string, err error)
func (*Local) SyncWithOrigin ¶ added in v1.1.23
func (*Local) ValidateSubmodules ¶ added in v1.2.6
func (repo *Local) ValidateSubmodules(ctx context.Context, pathMatcher path_matcher.PathMatcher, opts ValidateSubmodulesOptions) error
func (*Local) WalkCommitFiles ¶ added in v1.2.5
func (repo *Local) WalkCommitFiles(ctx context.Context, commit string, dir string, pathMatcher path_matcher.PathMatcher, fileFunc func(notResolvedPath string) error) error
type LsTreeOptions ¶
type OpenLocalRepoOptions ¶ added in v1.1.21
type OpenLocalRepoOptions struct {
Dev bool
}
type PatchFile ¶
type PatchFile struct { FilePath string Descriptor *true_git.PatchDescriptor }
func (*PatchFile) GetBinaryPaths ¶
func (*PatchFile) GetFilePath ¶
type PatchOptions ¶
type PatchOptions struct { FilterOptions FromCommit, ToCommit string WithEntireFileContext bool WithBinary bool }
type Remote ¶
func OpenRemoteRepo ¶
func (*Remote) CreateDetachedMergeCommit ¶
func (*Remote) GetClonePath ¶
func (*Remote) GetMergeCommitParents ¶
func (*Remote) GetOrCreateArchive ¶ added in v1.2.6
func (*Remote) GetOrCreateChecksum ¶ added in v1.2.6
func (*Remote) GetOrCreatePatch ¶ added in v1.2.6
func (*Remote) IsAncestor ¶
func (*Remote) IsCommitExists ¶
func (*Remote) LatestBranchCommit ¶
func (*Remote) RemoteBranchesList ¶
func (*Remote) RemoteOriginUrl ¶
func (*Remote) ValidateEndpoint ¶
type StatusPathListOptions ¶ added in v1.2.8
type StatusPathListOptions struct {
OnlyWorktreeChanges bool
}
type SubmoduleAddedAndNotCommittedError ¶ added in v1.2.8
type SubmoduleAddedAndNotCommittedError SubmoduleErrorBase
type SubmoduleCommitChangedError ¶ added in v1.2.8
type SubmoduleCommitChangedError SubmoduleErrorBase
type SubmoduleDeletedError ¶ added in v1.2.8
type SubmoduleDeletedError SubmoduleErrorBase
type SubmoduleErrorBase ¶ added in v1.2.8
type SubmoduleErrorBase struct { SubmodulePath string // contains filtered or unexported fields }
type SubmoduleHasUncommittedChangesError ¶ added in v1.2.8
type SubmoduleHasUncommittedChangesError SubmoduleErrorBase
type SubmoduleHasUntrackedChangesError ¶ added in v1.2.8
type SubmoduleHasUntrackedChangesError SubmoduleErrorBase
type ValidateSubmodulesOptions ¶ added in v1.2.8
type ValidateSubmodulesOptions StatusPathListOptions