Documentation ¶
Index ¶
- Constants
- type CatfileInfoIterator
- func CatfileInfo(ctx context.Context, catfile catfile.Batch, revlistIterator RevlistIterator) CatfileInfoIterator
- func CatfileInfoAllObjects(ctx context.Context, repo *localrepo.Repo) CatfileInfoIterator
- func CatfileInfoFilter(ctx context.Context, it CatfileInfoIterator, ...) CatfileInfoIterator
- func NewCatfileInfoIterator(items []CatfileInfoResult) CatfileInfoIterator
- type CatfileInfoResult
- type CatfileObjectIterator
- type CatfileObjectResult
- type ObjectType
- type RevlistIterator
- type RevlistOption
- type RevlistResult
Constants ¶
const ( // ObjectTypeCommit is the type of a Git commit. ObjectTypeCommit = ObjectType("commit") // ObjectTypeBlob is the type of a Git blob. ObjectTypeBlob = ObjectType("blob") // ObjectTypeTree is the type of a Git tree. ObjectTypeTree = ObjectType("tree") // ObjectTypeTag is the type of a Git tag. ObjectTypeTag = ObjectType("tag") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatfileInfoIterator ¶
type CatfileInfoIterator interface { // Next iterates to the next item. Returns `false` in case there are no more results left. Next() bool // Err returns the first error that was encountered. Err() error // Result returns the current item. Result() CatfileInfoResult }
CatfileInfoIterator is an iterator returned by the Revlist function.
func CatfileInfo ¶
func CatfileInfo(ctx context.Context, catfile catfile.Batch, revlistIterator RevlistIterator) CatfileInfoIterator
CatfileInfo processes revlistResults from the given channel and extracts object information via `git cat-file --batch-check`. The returned channel will contain all processed catfile info results. Any error received via the channel or encountered in this step will cause the pipeline to fail. Context cancellation will gracefully halt the pipeline.
func CatfileInfoAllObjects ¶
func CatfileInfoAllObjects(ctx context.Context, repo *localrepo.Repo) CatfileInfoIterator
CatfileInfoAllObjects enumerates all Git objects part of the repository's object directory and extracts their object info via `git cat-file --batch-check`. The returned channel will contain all processed results. Any error encountered during execution of this pipeline step will cause the pipeline to fail. Context cancellation will gracefully halt the pipeline. Note that with this pipeline step, the resulting catfileInfoResults will never have an object name.
func CatfileInfoFilter ¶
func CatfileInfoFilter(ctx context.Context, it CatfileInfoIterator, filter func(CatfileInfoResult) bool) CatfileInfoIterator
CatfileInfoFilter filters the catfileInfoResults from the provided channel with the filter function: if the filter returns `false` for a given item, then it will be dropped from the pipeline. Errors cannot be filtered and will always be passed through.
func NewCatfileInfoIterator ¶
func NewCatfileInfoIterator(items []CatfileInfoResult) CatfileInfoIterator
NewCatfileInfoIterator returns a new CatfileInfoIterator for the given items.
type CatfileInfoResult ¶
type CatfileInfoResult struct { // ObjectName is the object name as received from the revlistResultChan. ObjectName []byte // ObjectInfo is the object info of the object. ObjectInfo *catfile.ObjectInfo // contains filtered or unexported fields }
CatfileInfoResult is a result for the CatfileInfo pipeline step.
type CatfileObjectIterator ¶
type CatfileObjectIterator interface { // Next iterates to the next item. Returns `false` in case there are no more results left. Next() bool // Err returns the first error that was encountered. Err() error // Result returns the current item. Result() CatfileObjectResult }
CatfileObjectIterator is an iterator returned by the Revlist function.
func CatfileObject ¶
func CatfileObject( ctx context.Context, catfileProcess catfile.Batch, it CatfileInfoIterator, ) CatfileObjectIterator
CatfileObject processes catfileInfoResults from the given channel and reads associated objects into memory via `git cat-file --batch`. The returned channel will contain all processed objects. Any error received via the channel or encountered in this step will cause the pipeline to fail. Context cancellation will gracefully halt the pipeline. The returned object readers must always be fully consumed by the caller.
func NewCatfileObjectIterator ¶
func NewCatfileObjectIterator(items []CatfileObjectResult) CatfileObjectIterator
NewCatfileObjectIterator returns a new CatfileObjectIterator for the given items.
type CatfileObjectResult ¶
type CatfileObjectResult struct { // ObjectName is the object name as received from the revlistResultChan. ObjectName []byte // ObjectInfo is the object info of the object. ObjectInfo *catfile.ObjectInfo // obbjectReader is the reader for the raw object data. The reader must always be consumed // by the caller. ObjectReader io.Reader // contains filtered or unexported fields }
CatfileObjectResult is a result for the CatfileObject pipeline step.
type ObjectType ¶
type ObjectType string
ObjectType is a Git object type used for filtering objects.
type RevlistIterator ¶
type RevlistIterator interface { // Next iterates to the next item. Returns `false` in case there are no more results left. Next() bool // Err returns the first error that was encountered. Err() error // Result returns the current item. Result() RevlistResult }
RevlistIterator is an iterator returned by the Revlist function.
func NewRevlistIterator ¶
func NewRevlistIterator(items []RevlistResult) RevlistIterator
NewRevlistIterator returns a new RevlistIterator for the given items.
func Revlist ¶
func Revlist( ctx context.Context, repo *localrepo.Repo, revisions []string, options ...RevlistOption, ) RevlistIterator
Revlist runs git-rev-list(1) with objects and object names enabled. The returned channel will contain all object IDs listed by this command. Cancelling the context will cause the pipeline to be cancelled, too.
func RevlistFilter ¶
func RevlistFilter(ctx context.Context, it RevlistIterator, filter func(RevlistResult) bool) RevlistIterator
RevlistFilter filters the RevlistResults from the provided iterator with the filter function: if the filter returns `false` for a given item, then it will be dropped from the pipeline. Errors cannot be filtered and will always be passed through.
type RevlistOption ¶
type RevlistOption func(cfg *revlistConfig)
RevlistOption is an option for the revlist pipeline step.
func WithBlobLimit ¶
func WithBlobLimit(limit int) RevlistOption
WithBlobLimit sets up a size limit for blobs. Only blobs whose size is smaller than this limit will be returned by the pipeline step.
func WithObjectTypeFilter ¶
func WithObjectTypeFilter(t ObjectType) RevlistOption
WithObjectTypeFilter will set up a `--filter=object:type=` filter for git-rev-list(1). This will cause it to filter out any objects which do not match the given type. Because git-rev-list(1) by default never filters provided arguments, this option also sets up the `--filter-provided` flag. Note that this option is only supported starting with Git v2.32.0 or later.
type RevlistResult ¶
type RevlistResult struct { // OID is the object ID of an object printed by git-rev-list(1). OID git.ObjectID // ObjectName is the name of the object. This is typically the path of the object if it was // traversed via either a tree or a commit. The path depends on the order in which objects // are traversed: if e.g. two different trees refer to the same blob with different names, // the blob's path depends on which of the trees was traversed first. ObjectName []byte // contains filtered or unexported fields }
RevlistResult is a result for the revlist pipeline step.