Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotExist indicates that the requested tree does not exist, either because the revision // is invalid or because the path is not valid. ErrNotExist = errors.New("invalid object name") // ErrNotTreeish indicates that the requested revision or path does not resolve to a tree // object. ErrNotTreeish = errors.New("not treeish") )
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
type Entry ¶
type Entry struct { Mode []byte Type ObjectType ObjectID git.ObjectID Path string }
Entry represents a single ls-tree entry
func ListEntries ¶
func ListEntries( ctx context.Context, repo *localrepo.Repo, treeish git.Revision, cfg *ListEntriesConfig, ) ([]*Entry, error)
ListEntries lists tree entries for the given treeish. By default, this will do a non-recursive listing starting from the root of the given treeish. This behaviour can be changed by passing a config.
type ListEntriesConfig ¶
type ListEntriesConfig struct { // Recursive indicates whether the listing shall be recursive or not. Recursive bool // RelativePath is the relative path at which listing of entries should be started. RelativePath string }
ListEntriesConfig is configuration that can be passed to ListEntries.
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, objectHash git.ObjectHash) *Parser
NewParser returns a new Parser
func (*Parser) NextEntryPath ¶ added in v15.5.0
NextEntryPath reads the path of next entry as it would be written by `git ls-tree --name-only -z`.