catfile

package
v1.34.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound added in v0.92.0

func IsNotFound(err error) bool

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

func New(ctx context.Context, repo *gitalypb.Repository) (*Batch, error)

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

func (c *Batch) Blob(revspec string) (io.Reader, error)

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

func (c *Batch) Commit(revspec string) (io.Reader, error)

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

func (c *Batch) Tag(revspec string) (io.Reader, error)

Tag returns a raw tag object. Caller must consume the Reader before making another call on C.

func (*Batch) Tree added in v0.92.0

func (c *Batch) Tree(revspec string) (io.Reader, error)

Tree returns a raw tree object. It is an error if revspec does not point to a tree. To prevent this firstuse Info to resolve the revspec and check the object type. 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

type ObjectInfo struct {
	Oid  string
	Type string
	Size int64
}

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"

Jump to

Keyboard shortcuts

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