lstree

package
v0.124.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrParse = errors.New("Failed to parse git ls-tree response")

ErrParse is returned when the parse of an entry was unsuccessful

Functions

This section is empty.

Types

type Entries

type Entries []Entry

Entries holds every ls-tree Entry

func (Entries) Len

func (e Entries) Len() int

func (Entries) Less

func (e Entries) Less(i, j int) bool

We need to sort in the format [*tree *blobs *submodules]

func (Entries) Swap

func (e Entries) Swap(i, j int)

type Entry

type Entry struct {
	Mode []byte
	Type ObjectType
	Oid  string
	Path string
}

Entry represents a single ls-tree entry

type ObjectType

type ObjectType int

ObjectType is an Enum for the type of object of the ls-tree entry, which can be can be tree, blob or commit

const (
	Tree ObjectType = iota
	Blob
	Submodule
)

Enum values for ObjectType

type Parser

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

Parser holds the necessary state for parsing the ls-tree output

func NewParser

func NewParser(src io.Reader) *Parser

NewParser returns a new Parser

func (*Parser) NextEntry

func (p *Parser) NextEntry() (*Entry, error)

NextEntry reads from git ls-tree --z --full-name command parses the tree entry and returns a *Entry.

Jump to

Keyboard shortcuts

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