objects

package
v0.0.0-...-d60a440 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectFind

func ObjectFind(gitRepo *repo.GitRepository, name, objType string, follow bool) (string, error)

ObjectFind resolves a name and optionally follows it to the desired object type.

func ObjectHash

func ObjectHash(fd io.Reader, objType string, gitRepo *repo.GitRepository) (string, error)

ObjectHash hashes an object from a reader.

func ObjectWrite

func ObjectWrite(obj GitObject, gitRepo *repo.GitRepository) (string, error)

ObjectWrite writes a GitObject to the repository.

func TreeToMap

func TreeToMap(gitRepo *repo.GitRepository, ref, prefix string) (map[string]string, error)

TreeToMap recursively reads a tree and flattens it into a map.

Types

type GitBlob

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

GitBlob represents a blob object.

func (*GitBlob) Deserialize

func (b *GitBlob) Deserialize(data []byte) error

func (*GitBlob) Serialize

func (b *GitBlob) Serialize() ([]byte, error)

func (*GitBlob) Type

func (b *GitBlob) Type() string

type GitCommit

type GitCommit struct {
	Kvlm    map[string][]string
	Message string
}

GitCommit represents a commit object.

func (*GitCommit) Deserialize

func (c *GitCommit) Deserialize(data []byte) error

func (*GitCommit) Serialize

func (c *GitCommit) Serialize() ([]byte, error)

func (*GitCommit) Type

func (c *GitCommit) Type() string

type GitObject

type GitObject interface {
	Serialize() ([]byte, error)
	Deserialize(data []byte) error
	Type() string
}

GitObject defines the interface for all git objects.

func ObjectRead

func ObjectRead(gitRepo *repo.GitRepository, sha string) (GitObject, error)

ObjectRead reads an object from the repository.

type GitTag

type GitTag struct {
	Kvlm    map[string][]string
	Message string
}

GitTag represents a tag object.

func (*GitTag) Deserialize

func (t *GitTag) Deserialize(data []byte) error

func (*GitTag) Serialize

func (t *GitTag) Serialize() ([]byte, error)

func (*GitTag) Type

func (t *GitTag) Type() string

type GitTree

type GitTree struct {
	Items []GitTreeLeaf
}

GitTree represents a tree object.

func (*GitTree) Deserialize

func (t *GitTree) Deserialize(data []byte) error

func (*GitTree) Serialize

func (t *GitTree) Serialize() ([]byte, error)

func (*GitTree) Type

func (t *GitTree) Type() string

type GitTreeLeaf

type GitTreeLeaf struct {
	Mode string
	Path string
	SHA  string // Stored as a hex string
}

GitTreeLeaf represents a single entry in a tree object.

Jump to

Keyboard shortcuts

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