Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶ added in v0.92.0
IsNotFound tests whether err has type NotFoundError.
Types ¶
type Batch ¶ added in v0.92.0
type Batch struct {
// contains filtered or unexported fields
}
Batch abstracts 'git cat-file --batch' and 'git cat-file --batch-check'. It lets you retrieve object metadata and raw objects from a Git repo.
A Batch instance can only serve single request at a time. If you want to use it across multiple goroutines you need to add your own locking.
func New ¶ added in v0.92.0
New returns a new Batch instance. It is important that ctx gets canceled somewhere, because if it doesn't the cat-file processes spawned by New() never terminate.
func (*Batch) Blob ¶ added in v0.92.0
Blob returns a reader for the requested blob. The entire blob must be read before any new objects can be requested from this Batch instance.
It is an error if revspec does not point to a blob. To prevent this first use Info to resolve the revspec and check the object type.
func (*Batch) Commit ¶ added in v0.92.0
Commit returns a raw commit object. It is an error if revspec does not point to a commit. To prevent this first use Info to resolve the revspec and check the object type. Caller must consume the Reader before making another call on C.
func (*Batch) Info ¶ added in v0.92.0
func (c *Batch) Info(revspec string) (*ObjectInfo, error)
Info returns an ObjectInfo if spec exists. If spec does not exist the error is of type NotFoundError.
func (*Batch) Tag ¶ added in v1.21.0
Tag returns a raw tag object. Caller must consume the Reader before making another call on C.
type NotFoundError ¶ added in v0.92.0
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is returned when requesting an object that does not exist.
type ObjectInfo ¶
ObjectInfo represents a header returned by `git cat-file --batch`
func (*ObjectInfo) IsBlob ¶ added in v0.116.0
func (o *ObjectInfo) IsBlob() bool
IsBlob returns true if object type is "blob"