Documentation
¶
Overview ¶
Package tree provides representations, parsers, and serializers for tree objects.
Index ¶
- func AppendPath(dst []byte, path [][]byte) []byte
- func ClonePath(path [][]byte) [][]byte
- func HasPathPrefix(path, prefix [][]byte) bool
- func SplitPath(path []byte) [][]byte
- func TreeEntryNameCompare(entryName []byte, entryMode FileMode, searchName []byte, searchIsTree bool) int
- type FileMode
- type Tree
- func (tree *Tree) Entry(name []byte) *TreeEntry
- func (tree *Tree) InsertEntry(newEntry TreeEntry) error
- func (tree *Tree) ObjectType() objecttype.Type
- func (tree *Tree) RemoveEntry(name []byte) error
- func (tree *Tree) SerializeWithHeader() ([]byte, error)
- func (tree *Tree) SerializeWithoutHeader() ([]byte, error)
- type TreeEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendPath ¶ added in v0.1.152
AppendPath appends path to dst as one slash-separated byte path.
func HasPathPrefix ¶ added in v0.1.152
HasPathPrefix reports whether path begins with prefix as whole components.
Types ¶
type FileMode ¶
type FileMode uint32
FileMode represents the mode of a file in a Git tree.
func (FileMode) HasSameType ¶ added in v0.1.157
HasSameType reports whether mode and other describe the same tree entry kind.
Regular files and executable files have the same type for diff-status purposes.
func (FileMode) IsBlobLike ¶ added in v0.1.152
IsBlobLike reports whether mode names one blob-like tree entry kind.
Blob-like entries store blob object IDs as their targets.
func (FileMode) IsRegularFile ¶ added in v0.1.157
IsRegularFile reports whether mode names one regular-file variant.
type Tree ¶
type Tree struct {
// Entries must be sorted by TreeEntryNameCompare.
// Use the Tree methods to preserve ordering and copy semantics rather than
// modifying the slice directly.
Entries []TreeEntry
}
Tree represents a fully materialized Git tree object.
Labels: MT-Unsafe.
func (*Tree) Entry ¶
Entry looks up a tree entry by name.
The returned pointer refers to storage within tree.Entries and must not be retained across InsertEntry or RemoveEntry calls.
func (*Tree) InsertEntry ¶
InsertEntry inserts a tree entry while preserving Git ordering.
InsertEntry copies newEntry.Name.
func (*Tree) ObjectType ¶
func (tree *Tree) ObjectType() objecttype.Type
ObjectType returns TypeTree.
func (*Tree) RemoveEntry ¶
RemoveEntry removes a tree entry by name.
func (*Tree) SerializeWithHeader ¶
SerializeWithHeader renders the raw object (header + body).
func (*Tree) SerializeWithoutHeader ¶
SerializeWithoutHeader renders the raw tree body bytes.