Documentation
¶
Index ¶
- Constants
- Variables
- func CleanUploadFileName(name string) string
- func GetReferenceFromBranchName(branchName string) string
- func GetReferenceFromTagName(tagName string) string
- func GetSubModules(rd *BlobReader) (map[string]*Submodule, error)
- func IsErrMoreThanOne(err error) bool
- func IsErrPushRejected(err error) bool
- func IsMergeUnrelatedHistoriesError(err error) bool
- func NewInMemoryLastCommitCache(cacheDuration time.Duration) cache.Cache[CommitEntryKey, *Commit]
- func NewRedisLastCommitCache(redisClient redis.UniversalClient, cacheDuration time.Duration) (cache.Cache[CommitEntryKey, *Commit], error)
- func NoLastCommitCache() cache.Cache[CommitEntryKey, *Commit]
- func ProvideLastCommitCache(config types.Config, redisClient redis.UniversalClient) (cache.Cache[CommitEntryKey, *Commit], error)
- func SanitizeCredentialURLs(s string) string
- type ArchiveAttribute
- type ArchiveFormat
- type ArchiveParams
- type BatchHeaderResponse
- type BlameNextReader
- type BlamePart
- type BlameReader
- type BlobReader
- type Branch
- type BranchFilter
- type CloneRepoOptions
- type Commit
- type CommitChangesOptions
- type CommitDivergence
- type CommitDivergenceRequest
- type CommitEntryKey
- type CommitFileStats
- type CommitFilter
- type CommitGPGSignature
- type CreateTagOptions
- type DiffShortStat
- type FS
- type FileContent
- type FileDiffRequest
- type FileDiffRequests
- type Git
- func (g *Git) AddFiles(ctx context.Context, repoPath string, all bool, files ...string) error
- func (g *Git) Archive(ctx context.Context, repoPath string, params ArchiveParams, w io.Writer) error
- func (g *Git) Blame(ctx context.Context, repoPath string, rev string, file string, lineFrom int, ...) BlameNextReader
- func (g *Git) Clone(ctx context.Context, from string, to string, opts CloneRepoOptions) error
- func (g *Git) Commit(ctx context.Context, repoPath string, opts CommitChangesOptions) error
- func (g *Git) CommitDiff(ctx context.Context, repoPath string, rev string, w io.Writer) error
- func (g *Git) Config(ctx context.Context, repoPath string, key string, value string) error
- func (g *Git) CountObjects(ctx context.Context, repoPath string) (ObjectCount, error)
- func (g *Git) CreateTag(ctx context.Context, repoPath string, name string, targetSHA sha.SHA, ...) error
- func (g *Git) DiffCut(ctx context.Context, repoPath string, targetRef string, sourceRef string, ...) (parser.HunkHeader, parser.Hunk, error)
- func (g *Git) DiffFileName(ctx context.Context, repoPath string, baseRef string, headRef string, ...) ([]string, error)
- func (g *Git) DiffShortStat(ctx context.Context, repoPath string, baseRef string, headRef string, ...) (DiffShortStat, error)
- func (g *Git) GetAnnotatedTag(ctx context.Context, repoPath string, rev string) (*Tag, error)
- func (g *Git) GetAnnotatedTags(ctx context.Context, repoPath string, revs []string) ([]Tag, error)
- func (g *Git) GetBranch(ctx context.Context, repoPath string, branchName string) (*Branch, error)
- func (g *Git) GetBranchCount(ctx context.Context, repoPath string) (int, error)
- func (g *Git) GetCommit(ctx context.Context, repoPath string, rev string) (*Commit, error)
- func (g *Git) GetCommitDivergences(ctx context.Context, repoPath string, requests []CommitDivergenceRequest, ...) ([]CommitDivergence, error)
- func (g *Git) GetCommits(ctx context.Context, repoPath string, refs []string) ([]*Commit, error)
- func (g *Git) GetDefaultBranch(ctx context.Context, repoPath string) (string, error)
- func (g *Git) GetDiffHunkHeaders(ctx context.Context, repoPath string, targetRef string, sourceRef string) ([]*parser.DiffFileHunkHeaders, error)
- func (g *Git) GetFullCommitID(ctx context.Context, repoPath string, shortID string) (sha.SHA, error)
- func (g *Git) GetLatestCommit(ctx context.Context, repoPath string, rev string, treePath string) (*Commit, error)
- func (g *Git) GetMergeBase(ctx context.Context, repoPath string, remote string, base string, head string) (sha.SHA, string, error)
- func (g *Git) GetRef(ctx context.Context, repoPath string, ref string) (sha.SHA, error)
- func (g *Git) GetRemoteDefaultBranch(ctx context.Context, remoteURL string) (string, error)
- func (g *Git) GetSubmodule(ctx context.Context, repoPath string, ref string, treePath string) (*Submodule, error)
- func (g *Git) GetTagCount(ctx context.Context, repoPath string) (int, error)
- func (g *Git) GetTreeNode(ctx context.Context, repoPath, rev, treePath string) (*TreeNode, error)
- func (g *Git) HasBranches(ctx context.Context, repoPath string) (bool, error)
- func (g *Git) HashObject(ctx context.Context, repoPath string, reader io.Reader) (sha.SHA, error)
- func (g *Git) InfoRefs(ctx context.Context, repoPath string, service string, w io.Writer, ...) error
- func (g *Git) InitRepository(ctx context.Context, repoPath string, bare bool) error
- func (g *Git) IsAncestor(ctx context.Context, repoPath string, alternates []string, ...) (bool, error)
- func (g *Git) IsBranchExist(ctx context.Context, repoPath, name string) (bool, error)
- func (g *Git) ListCommitSHAs(ctx context.Context, repoPath string, alternateObjectDirs []string, ref string, ...) ([]string, error)
- func (g *Git) ListCommits(ctx context.Context, repoPath string, ref string, page int, limit int, ...) ([]*Commit, []PathRenameDetails, error)
- func (g *Git) ListPaths(ctx context.Context, repoPath string, rev string, includeDirs bool) (files []string, dirs []string, err error)
- func (g *Git) ListTreeNodes(ctx context.Context, repoPath, rev, treePath string) ([]TreeNode, error)
- func (g *Git) MatchFiles(ctx context.Context, repoPath string, rev string, treePath string, ...) ([]FileContent, error)
- func (g *Git) PathsDetails(ctx context.Context, repoPath string, rev string, paths []string) ([]PathDetails, error)
- func (g *Git) Push(ctx context.Context, repoPath string, opts PushOptions) error
- func (g *Git) RawDiff(ctx context.Context, w io.Writer, repoPath string, baseRef string, ...) error
- func (g *Git) ReadTree(ctx context.Context, repoPath string, ref string, w io.Writer, args ...string) error
- func (g *Git) ResolveRev(ctx context.Context, repoPath string, rev string) (sha.SHA, error)
- func (g *Git) ServicePack(ctx context.Context, repoPath string, options ServicePackOptions) error
- func (g *Git) SetDefaultBranch(ctx context.Context, repoPath string, defaultBranch string, allowEmpty bool) error
- func (g *Git) Sync(ctx context.Context, repoPath string, source string, refSpecs []string) error
- func (g *Git) WalkReferences(ctx context.Context, repoPath string, handler WalkReferencesHandler, ...) error
- type GitObjectType
- type GitReferenceField
- type Identity
- type MergeUnrelatedHistoriesError
- type MoreThanOneError
- type ObjectCount
- type PathDetails
- type PathRenameDetails
- type PushOptions
- type PushOutOfDateError
- type PushRejectedError
- type ServicePackOptions
- type Signature
- type SortOrder
- type Submodule
- type Tag
- type TreeNode
- type TreeNodeMode
- type TreeNodeType
- type TreeNodeWithCommit
- type WalkInstruction
- type WalkReferencesEntry
- type WalkReferencesHandler
- type WalkReferencesInstructor
- type WalkReferencesOptions
- type WriteCloserError
Constants ¶
const BranchPrefix = "refs/heads/"
BranchPrefix base dir of the branch information file store on git.
const (
// GitTimeLayout is the (default) time layout used by git.
GitTimeLayout = "Mon Jan _2 15:04:05 2006 -0700"
)
const (
// RemotePrefix is the base directory of the remotes information of git.
RemotePrefix = "refs/remotes/"
)
const TagPrefix = "refs/tags/"
TagPrefix tags prefix path on the repository.
Variables ¶
var ( ErrInvalidPath = errors.New("path is invalid") ErrRepositoryPathEmpty = errors.InvalidArgument("repository path cannot be empty") ErrBranchNameEmpty = errors.InvalidArgument("branch name cannot be empty") ErrParseDiffHunkHeader = errors.Internal(nil, "failed to parse diff hunk header") ErrNoDefaultBranch = errors.New("no default branch") ErrInvalidSignature = errors.New("invalid signature") )
var ArchiveFormats = []ArchiveFormat{ ArchiveFormatTar, ArchiveFormatZip, ArchiveFormatTarGz, ArchiveFormatTgz, }
var WireSet = wire.NewSet( ProvideLastCommitCache, )
Functions ¶
func CleanUploadFileName ¶
CleanUploadFileName Trims a filename and returns empty string if it is a .git directory.
func GetReferenceFromBranchName ¶
GetReferenceFromBranchName assumes the provided value is the branch name (not the ref!) and first sanitizes the branch name (remove any spaces or 'refs/heads/' prefix) It then returns the full form of the branch reference.
func GetReferenceFromTagName ¶
func GetSubModules ¶
func GetSubModules(rd *BlobReader) (map[string]*Submodule, error)
GetSubModules get all the sub modules of current revision git tree.
func IsErrMoreThanOne ¶
IsErrMoreThanOne checks if an error is a MoreThanOneError.
func IsErrPushRejected ¶
IsErrPushRejected checks if an error is a PushRejectedError.
func NewRedisLastCommitCache ¶
func NoLastCommitCache ¶
func NoLastCommitCache() cache.Cache[CommitEntryKey, *Commit]
func ProvideLastCommitCache ¶
func SanitizeCredentialURLs ¶
SanitizeCredentialURLs remove all credentials in URLs (starting with "scheme://") for the input string: "https://user:pass@domain.com" => "https://sanitized-credential@domain.com"
Types ¶
type ArchiveAttribute ¶
type ArchiveAttribute string
const ( ArchiveAttributeExportIgnore ArchiveAttribute = "export-ignore" ArchiveAttributeExportSubst ArchiveAttribute = "export-subst" )
func (ArchiveAttribute) Validate ¶
func (f ArchiveAttribute) Validate() error
type ArchiveFormat ¶
type ArchiveFormat string
const ( ArchiveFormatTar ArchiveFormat = "tar" ArchiveFormatZip ArchiveFormat = "zip" ArchiveFormatTarGz ArchiveFormat = "tar.gz" ArchiveFormatTgz ArchiveFormat = "tgz" )
func ParseArchiveFormat ¶
func ParseArchiveFormat(format string) (ArchiveFormat, error)
func (ArchiveFormat) Validate ¶
func (f ArchiveFormat) Validate() error
type ArchiveParams ¶
type ArchiveParams struct { // Format of the resulting archive. Possible values are tar, zip, tar.gz, tgz, // and any format defined using the configuration option tar.<format>.command // If --format is not given, and the output file is specified, the format is inferred // from the filename if possible (e.g. writing to foo.zip makes the output to be in the zip format), // Otherwise the output format is tar. Format ArchiveFormat // Prefix prepend <prefix>/ to paths in the archive. Can be repeated; its rightmost value is used // for all tracked files. Prefix string // Write the archive to <file> instead of stdout. File string // export-ignore // Files and directories with the attribute export-ignore won’t be added to archive files. // See gitattributes[5] for details. // // export-subst // If the attribute export-subst is set for a file then Git will expand several placeholders // when adding this file to an archive. See gitattributes[5] for details. Attributes ArchiveAttribute // Set modification time of archive entries. Without this option the committer time is // used if <tree-ish> is a commit or tag, and the current time if it is a tree. Time *time.Time // Compression is level used for tar.gz and zip packers. Compression *int // The tree or commit to produce an archive for. Treeish string // Paths is optional parameter, all files and subdirectories of the // current working directory are included in the archive, if one or more paths // are specified, only these are included. Paths []string }
func (*ArchiveParams) Validate ¶
func (p *ArchiveParams) Validate() error
type BatchHeaderResponse ¶
func ReadBatchHeaderLine ¶
func ReadBatchHeaderLine(rd *bufio.Reader) (*BatchHeaderResponse, error)
ReadBatchHeaderLine reads the header line from cat-file --batch <sha> SP <type> SP <size> LF sha is a 40byte not 20byte here.
type BlameNextReader ¶
type BlameReader ¶
type BlameReader struct {
// contains filtered or unexported fields
}
func (*BlameReader) NextPart ¶
func (r *BlameReader) NextPart() (*BlamePart, error)
type BlobReader ¶
type BranchFilter ¶
type CloneRepoOptions ¶
type Commit ¶
type Commit struct { SHA sha.SHA `json:"sha"` Title string `json:"title"` Message string `json:"message,omitempty"` Author Signature `json:"author"` Committer Signature `json:"committer"` Signature *CommitGPGSignature ParentSHAs []sha.SHA FileStats []CommitFileStats `json:"file_stats,omitempty"` }
func CommitFromReader ¶
CommitFromReader will generate a Commit from a provided reader We need this to interpret commits from cat-file or cat-file --batch
If used as part of a cat-file --batch stream you need to limit the reader to the correct size.
type CommitChangesOptions ¶
type CommitDivergence ¶
type CommitDivergence struct { // Ahead is the count of commits the 'From' ref is ahead of the 'To' ref. Ahead int32 // Behind is the count of commits the 'From' ref is behind the 'To' ref. Behind int32 }
CommitDivergence contains the information of the count of converging commits between two refs.
type CommitDivergenceRequest ¶
type CommitDivergenceRequest struct { // From is the ref from which the counting of the diverging commits starts. From string // To is the ref at which the counting of the diverging commits ends. To string }
CommitDivergenceRequest contains the refs for which the converging commits should be counted.
type CommitEntryKey ¶
type CommitEntryKey string
type CommitFileStats ¶
type CommitFilter ¶
type CommitGPGSignature ¶
CommitGPGSignature represents a git commit signature part.
type CreateTagOptions ¶
type CreateTagOptions struct { // Message is the optional message the tag will be created with - if the message is empty // the tag will be lightweight, otherwise it'll be annotated. Message string // Tagger is the information used in case the tag is annotated (Message is provided). Tagger Signature }
type DiffShortStat ¶
func GetDiffShortStat ¶
func GetDiffShortStat( ctx context.Context, repoPath string, args ...string, ) (DiffShortStat, error)
GetDiffShortStat counts number of changed files, number of additions and deletions.
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS represents a git filesystem. It implements fs.FS interface.
func (*FS) Glob ¶
Glob returns all file names that match the pattern. It is part of the fs.GlobFS interface.
func (*FS) ReadDir ¶
ReadDir returns all entries for a directory. It is part of the fs.ReadDirFS interface.
type FileContent ¶
type FileDiffRequest ¶
type FileDiffRequests ¶
type FileDiffRequests []FileDiffRequest
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
func New ¶
func New( config types.Config, lastCommitCache cache.Cache[CommitEntryKey, *Commit], githookFactory hook.ClientFactory, ) (*Git, error)
func (*Git) CommitDiff ¶
CommitDiff will stream diff for provided ref.
func (*Git) CountObjects ¶
func (*Git) CreateTag ¶
func (g *Git) CreateTag( ctx context.Context, repoPath string, name string, targetSHA sha.SHA, opts *CreateTagOptions, ) error
CreateTag creates the tag pointing at the provided SHA (could be any type, e.g. commit, tag, blob, ...)
func (*Git) DiffCut ¶
func (g *Git) DiffCut( ctx context.Context, repoPath string, targetRef string, sourceRef string, path string, params parser.DiffCutParams, ) (parser.HunkHeader, parser.Hunk, error)
DiffCut parses full file git diff output and returns lines specified with the parameters. The purpose of this function is to get diff data with which code comments could be generated.
func (*Git) DiffFileName ¶
func (*Git) DiffShortStat ¶
func (*Git) GetAnnotatedTag ¶
GetAnnotatedTag returns the tag for a specific tag sha.
func (*Git) GetAnnotatedTags ¶
func (g *Git) GetAnnotatedTags( ctx context.Context, repoPath string, revs []string, ) ([]Tag, error)
GetAnnotatedTags returns the tags for a specific list of tag sha.
func (*Git) GetBranch ¶
func (g *Git) GetBranch( ctx context.Context, repoPath string, branchName string, ) (*Branch, error)
GetBranch gets an existing branch.
func (*Git) GetBranchCount ¶
func (*Git) GetCommitDivergences ¶
func (g *Git) GetCommitDivergences( ctx context.Context, repoPath string, requests []CommitDivergenceRequest, max int32, ) ([]CommitDivergence, error)
GetCommitDivergences returns the count of the diverging commits for all branch pairs. IMPORTANT: If a max is provided it limits the overal count of diverging commits (max 10 could lead to (0, 10) while it's actually (2, 12)).
func (*Git) GetCommits ¶
GetCommits returns the (latest) commits for a specific list of refs. Note: ref can be Branch / Tag / CommitSHA.
func (*Git) GetDefaultBranch ¶
GetDefaultBranch gets the default branch of a repo.
func (*Git) GetDiffHunkHeaders ¶
func (g *Git) GetDiffHunkHeaders( ctx context.Context, repoPath string, targetRef string, sourceRef string, ) ([]*parser.DiffFileHunkHeaders, error)
GetDiffHunkHeaders for each file in diff output returns file name (old and new to detect renames), and all hunk headers. The diffs are generated with unified=0 parameter to create minimum sized hunks. Hunks' body is ignored. The purpose of this function is to get data based on which code comments could be repositioned.
func (*Git) GetFullCommitID ¶
func (*Git) GetLatestCommit ¶
func (g *Git) GetLatestCommit( ctx context.Context, repoPath string, rev string, treePath string, ) (*Commit, error)
GetLatestCommit gets the latest commit of a path relative from the provided revision.
func (*Git) GetMergeBase ¶
func (g *Git) GetMergeBase( ctx context.Context, repoPath string, remote string, base string, head string, ) (sha.SHA, string, error)
GetMergeBase checks and returns merge base of two branches and the reference used as base.
func (*Git) GetRef ¶
GetRef get's the target of a reference IMPORTANT provide full reference name to limit risk of collisions across reference types (e.g `refs/heads/main` instead of `main`).
func (*Git) GetRemoteDefaultBranch ¶
GetRemoteDefaultBranch retrieves the default branch of a remote repository. If the repo doesn't have a default branch, types.ErrNoDefaultBranch is returned.
func (*Git) GetSubmodule ¶
func (g *Git) GetSubmodule( ctx context.Context, repoPath string, ref string, treePath string, ) (*Submodule, error)
GetSubmodule returns the submodule at the given path reachable from ref. Note: ref can be Branch / Tag / CommitSHA.
func (*Git) GetTagCount ¶
func (*Git) GetTreeNode ¶
GetTreeNode returns the tree node at the given path as found for the provided reference.
func (*Git) HasBranches ¶
HasBranches returns true iff there's at least one branch in the repo (any branch) NOTE: This is different from repo.Empty(), as it doesn't care whether the existing branch is the default branch or not.
func (*Git) HashObject ¶
func (*Git) InitRepository ¶
InitRepository initializes a new Git repository.
func (*Git) IsAncestor ¶
func (g *Git) IsAncestor( ctx context.Context, repoPath string, alternates []string, ancestorCommitSHA, descendantCommitSHA sha.SHA, ) (bool, error)
IsAncestor returns if the provided commit SHA is ancestor of the other commit SHA.
func (*Git) IsBranchExist ¶
func (*Git) ListCommitSHAs ¶
func (g *Git) ListCommitSHAs( ctx context.Context, repoPath string, alternateObjectDirs []string, ref string, page int, limit int, filter CommitFilter, ) ([]string, error)
ListCommitSHAs lists the commits reachable from ref. Note: ref & afterRef can be Branch / Tag / CommitSHA. Note: commits returned are [ref->...->afterRef).
func (*Git) ListCommits ¶
func (g *Git) ListCommits( ctx context.Context, repoPath string, ref string, page int, limit int, includeStats bool, filter CommitFilter, ) ([]*Commit, []PathRenameDetails, error)
ListCommits lists the commits reachable from ref. Note: ref & afterRef can be Branch / Tag / CommitSHA. Note: commits returned are [ref->...->afterRef).
func (*Git) ListPaths ¶
func (g *Git) ListPaths( ctx context.Context, repoPath string, rev string, includeDirs bool, ) (files []string, dirs []string, err error)
ListPaths lists all the paths in a repo recursively (similar-ish to `ls -lR`). Note: Keep method simple for now to avoid unnecessary corner cases by always listing whole repo content (and not relative to any directory).
func (*Git) ListTreeNodes ¶
func (g *Git) ListTreeNodes(ctx context.Context, repoPath, rev, treePath string) ([]TreeNode, error)
ListTreeNodes lists the child nodes of a tree reachable from ref via the specified path.
func (*Git) MatchFiles ¶
func (*Git) PathsDetails ¶
func (g *Git) PathsDetails(ctx context.Context, repoPath string, rev string, paths []string, ) ([]PathDetails, error)
PathsDetails returns additional details about provided the paths.
func (*Git) Push ¶
Push pushs local commits to given remote branch. TODOD: return our own error types and move to above api.Push method
func (*Git) ResolveRev ¶
func (*Git) ServicePack ¶
func (*Git) SetDefaultBranch ¶
func (g *Git) SetDefaultBranch( ctx context.Context, repoPath string, defaultBranch string, allowEmpty bool, ) error
SetDefaultBranch sets the default branch of a repo.
func (*Git) Sync ¶
Sync synchronizes the repository to match the provided source. NOTE: This is a read operation and doesn't trigger any server side hooks.
func (*Git) WalkReferences ¶
func (g *Git) WalkReferences( ctx context.Context, repoPath string, handler WalkReferencesHandler, opts *WalkReferencesOptions, ) error
WalkReferences uses the provided options to filter the available references of the repo, and calls the handle function for every matching node. The instructor & handler are called with a map that contains the matching value for every field provided in fields. TODO: walkReferences related code should be moved to separate file.
type GitObjectType ¶
type GitObjectType string
const ( GitObjectTypeCommit GitObjectType = "commit" GitObjectTypeTree GitObjectType = "tree" GitObjectTypeBlob GitObjectType = "blob" GitObjectTypeTag GitObjectType = "tag" )
func ParseGitObjectType ¶
func ParseGitObjectType(t string) (GitObjectType, error)
type GitReferenceField ¶
type GitReferenceField string
GitReferenceField represents the different fields available When listing references. For the full list, see https://git-scm.com/docs/git-for-each-ref#_field_names
const ( GitReferenceFieldRefName GitReferenceField = "refname" GitReferenceFieldObjectType GitReferenceField = "objecttype" GitReferenceFieldObjectName GitReferenceField = "objectname" GitReferenceFieldCreatorDate GitReferenceField = "creatordate" )
func ParseGitReferenceField ¶
func ParseGitReferenceField(f string) (GitReferenceField, error)
type MergeUnrelatedHistoriesError ¶
type MergeUnrelatedHistoriesError struct {}
MergeUnrelatedHistoriesError represents an error if merging fails due to unrelated histories.
func (*MergeUnrelatedHistoriesError) Error ¶
func (e *MergeUnrelatedHistoriesError) Error() string
func (*MergeUnrelatedHistoriesError) Is ¶
func (e *MergeUnrelatedHistoriesError) Is(target error) bool
func (*MergeUnrelatedHistoriesError) Unwrap ¶
func (e *MergeUnrelatedHistoriesError) Unwrap() error
type MoreThanOneError ¶
MoreThanOneError represents an error when there are more than one sources (branch, tag) with the same name.
func (*MoreThanOneError) Error ¶
func (err *MoreThanOneError) Error() string
type ObjectCount ¶
type ObjectCount struct { Count int Size int64 InPack int Packs int SizePack int64 PrunePackable int Garbage int SizeGarbage int64 }
ObjectCount represents the parsed information from the `git count-objects -v` command. For field meanings, see https://git-scm.com/docs/git-count-objects#_options.
type PathDetails ¶
type PathRenameDetails ¶
type PushOptions ¶
type PushOutOfDateError ¶
PushOutOfDateError represents an error if merging fails due to unrelated histories.
func (*PushOutOfDateError) Error ¶
func (err *PushOutOfDateError) Error() string
func (*PushOutOfDateError) Unwrap ¶
func (err *PushOutOfDateError) Unwrap() error
Unwrap unwraps the underlying error.
type PushRejectedError ¶
PushRejectedError represents an error if merging fails due to rejection from a hook.
func (*PushRejectedError) Error ¶
func (err *PushRejectedError) Error() string
func (*PushRejectedError) GenerateMessage ¶
func (err *PushRejectedError) GenerateMessage()
GenerateMessage generates the remote message from the stderr.
func (*PushRejectedError) Unwrap ¶
func (err *PushRejectedError) Unwrap() error
Unwrap unwraps the underlying error.
type ServicePackOptions ¶
type Signature ¶
type Signature struct { Identity Identity // When is the timestamp of the Signature. When time.Time }
Signature represents the Author or Committer information.
func DecodeSignature ¶
DecodeSignature decodes a byte array representing a signature to signature.
type Tag ¶
type Tag struct { Sha sha.SHA Name string TargetSha sha.SHA TargetType GitObjectType Title string Message string Tagger Signature Signature *CommitGPGSignature }
type TreeNode ¶
type TreeNode struct { NodeType TreeNodeType Mode TreeNodeMode SHA sha.SHA Name string Path string Size int64 }
func GetTreeNode ¶
func GetTreeNode(ctx context.Context, repoPath, rev, treePath string, fetchSize bool) (*TreeNode, error)
GetTreeNode returns the tree node at the given path as found for the provided reference.
func ListTreeNodes ¶
func ListTreeNodes(ctx context.Context, repoPath, rev, treePath string, fetchSizes bool) ([]TreeNode, error)
ListTreeNodes lists the child nodes of a tree reachable from ref via the specified path.
func (*TreeNode) IsExecutable ¶
func (*TreeNode) IsSubmodule ¶
type TreeNodeMode ¶
type TreeNodeMode int
TreeNodeMode specifies the different modes of a node in a git tree. IMPORTANT: has to be consistent with rpc.TreeNodeMode (proto).
const ( TreeNodeModeFile TreeNodeMode = iota TreeNodeModeSymlink TreeNodeModeExec TreeNodeModeTree TreeNodeModeCommit )
func (TreeNodeMode) String ¶
func (m TreeNodeMode) String() string
type TreeNodeType ¶
type TreeNodeType int
TreeNodeType specifies the different types of nodes in a git tree. IMPORTANT: has to be consistent with rpc.TreeNodeType (proto).
const ( TreeNodeTypeTree TreeNodeType = iota TreeNodeTypeBlob TreeNodeTypeCommit )
type TreeNodeWithCommit ¶
type WalkInstruction ¶
type WalkInstruction int
const ( WalkInstructionStop WalkInstruction = iota WalkInstructionHandle WalkInstructionSkip )
func DefaultInstructor ¶
func DefaultInstructor( _ WalkReferencesEntry, ) (WalkInstruction, error)
type WalkReferencesEntry ¶
type WalkReferencesEntry map[GitReferenceField]string
type WalkReferencesHandler ¶
type WalkReferencesHandler func(WalkReferencesEntry) error
TODO: can be generic (so other walk methods can use the same)
type WalkReferencesInstructor ¶
type WalkReferencesInstructor func(WalkReferencesEntry) (WalkInstruction, error)
TODO: can be generic (so other walk methods can use the same)
type WalkReferencesOptions ¶
type WalkReferencesOptions struct { // Patterns are the patterns used to pre-filter the references of the repo. // OPTIONAL. By default all references are walked. Patterns []string // Fields indicates the fields that are passed to the instructor & handler // OPTIONAL. Default fields are: // - GitReferenceFieldRefName // - GitReferenceFieldObjectName Fields []GitReferenceField // Instructor indicates on how to handle the reference. // OPTIONAL. By default all references are handled. // NOTE: once walkInstructionStop is returned, the walking stops. Instructor WalkReferencesInstructor // Sort indicates the field by which the references should be sorted. // OPTIONAL. By default GitReferenceFieldRefName is used. Sort GitReferenceField // Order indicates the Order (asc or desc) of the sorted output Order SortOrder // MaxWalkDistance is the maximum number of nodes that are iterated over before the walking stops. // OPTIONAL. A value of <= 0 will walk all references. // WARNING: Skipped elements count towards the walking distance MaxWalkDistance int32 }
type WriteCloserError ¶
type WriteCloserError interface { io.WriteCloser CloseWithError(err error) error }
WriteCloserError wraps an io.WriteCloser with an additional CloseWithError function.
func CatFileBatch ¶
func CatFileBatch( ctx context.Context, repoPath string, alternateObjectDirs []string, flags ...command.CmdOptionFunc, ) (WriteCloserError, *bufio.Reader, func())
CatFileBatch opens git cat-file --batch in the provided repo and returns a stdin pipe, a stdout reader and cancel function.
func CatFileBatchCheck ¶
func CatFileBatchCheck( ctx context.Context, repoPath string, alternateObjectDirs []string, flags ...command.CmdOptionFunc, ) (WriteCloserError, *bufio.Reader, func())