object

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidObject       = errors.New("invalid object")
	ErrInvalidTreeObject   = errors.New("invalid tree object")
	ErrInvalidCommitObject = errors.New("invalid commit object")
	ErrNotCommitObject     = errors.New("not commit object")
	ErrIOHandling          = errors.New("IO handling error")
)

Functions

This section is empty.

Types

type Commit

type Commit struct {
	*Object
	Tree      sha.SHA1
	Parents   []sha.SHA1
	Author    Sign
	Committer Sign
	Message   string
}

func NewCommit

func NewCommit(o *Object) (*Commit, error)

func (*Commit) String

func (c *Commit) String() string

type Node added in v1.2.1

type Node struct {
	Hash     sha.SHA1
	Name     string
	Children []*Node
}

func GetNode added in v1.4.0

func GetNode(children []*Node, path string) (*Node, bool)

func (*Node) GetPaths added in v1.11.1

func (n *Node) GetPaths() []string

type Object

type Object struct {
	Type Type
	Hash sha.SHA1
	Size int
	Data []byte
}

func GetObject

func GetObject(rootGoitPath string, hash sha.SHA1) (*Object, error)

func NewObject

func NewObject(objType Type, data []byte) (*Object, error)

func (*Object) Header

func (o *Object) Header() []byte

func (*Object) ReflectToWorkingTree added in v1.10.0

func (o *Object) ReflectToWorkingTree(rootGoitPath, path string) error

func (*Object) Write

func (o *Object) Write(rootGoitPath string) error

type Sign

type Sign struct {
	Name      string
	Email     string
	Timestamp time.Time
}

func NewSign

func NewSign(name, email string) *Sign

func (Sign) String

func (s Sign) String() string

type Tree added in v1.2.1

type Tree struct {
	Children []*Node
	// contains filtered or unexported fields
}

func NewTree added in v1.2.1

func NewTree(rootGoitPath string, object *Object) (*Tree, error)

func (*Tree) String added in v1.2.1

func (t *Tree) String() string

type Type

type Type int
const (
	UndefinedObject Type = iota
	BlobObject
	TreeObject
	CommitObject
	TagObject
)

func NewType

func NewType(typeString string) (Type, error)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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