repr

package
v0.0.0-...-4216d52 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorCorruptedObject       = errors.New("corrupted object")
	ErrorCorruptedObjectHeader = fmt.Errorf("%w: corrupted header", ErrorCorruptedObject)
	ErrorUnknownObjectType     = errors.New("unknown object type")

	ErrorSizeNotMatch    = errors.New("object size does not match")
	ErrorUnknownFileMode = errors.New("unknown file mode")
)

Functions

func HashSize

func HashSize() int

func StripObjectHeader

func StripObjectHeader(o Object) []byte

Types

type Blob

type Blob struct {
	LazyObject
	// contains filtered or unexported fields
}

func NewBlob

func NewBlob(r io.Reader) (*Blob, error)

func (*Blob) Init

func (b *Blob) Init(r io.Reader) (*Blob, error)

func (*Blob) Raw

func (b *Blob) Raw() []byte

func (*Blob) String

func (b *Blob) String() string

func (*Blob) Type

func (b *Blob) Type() string

type LazyObject

type LazyObject struct {
	// contains filtered or unexported fields
}

func (*LazyObject) Compressed

func (lo *LazyObject) Compressed() ([]byte, error)

func (*LazyObject) Digest

func (lo *LazyObject) Digest() string

type Object

type Object interface {
	// Object's bytes
	Raw() []byte
	// Compressed object's bytes
	Compressed() ([]byte, error)
	// Object's digest (hex string)
	Digest() string
	// Representation for pretty-printing an object
	String() string
	Type() string
}

func ParseObject

func ParseObject(compressed []byte) (Object, error)

type ObjectModeType

type ObjectModeType string
const (
	ModeNormal       ObjectModeType = "100644"
	ModeExecutable   ObjectModeType = "100755"
	ModeSymbolicLink ObjectModeType = "120000"
	ModeTree         ObjectModeType = "40000"
)

type Tree

type Tree struct {
	LazyObject
	// contains filtered or unexported fields
}

func NewTree

func NewTree(r io.Reader) (*Tree, error)

func (*Tree) Init

func (t *Tree) Init(r io.Reader) (*Tree, error)

func (*Tree) Raw

func (t *Tree) Raw() []byte

func (*Tree) String

func (t *Tree) String() (res string)

func (*Tree) Type

func (t *Tree) Type() string

Jump to

Keyboard shortcuts

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