properly resolve cyclic dependency

This commit is contained in:
Jesse Duffield 2022-01-22 00:13:51 +11:00
parent 4ab5e54139
commit 5b7dd9e43c
22 changed files with 768 additions and 641 deletions

View file

@ -11,6 +11,8 @@ type CommitFileNode struct {
CompressionLevel int // equal to the number of forward slashes you'll see in the path when it's rendered in tree mode
}
var _ INode = &CommitFileNode{}
// methods satisfying ListItem interface
func (s *CommitFileNode) ID() string {
@ -23,6 +25,10 @@ func (s *CommitFileNode) Description() string {
// methods satisfying INode interface
func (s *CommitFileNode) IsNil() bool {
return s == nil
}
func (s *CommitFileNode) IsLeaf() bool {
return s.File != nil
}
@ -139,13 +145,6 @@ func (s *CommitFileNode) Compress() {
compressAux(s)
}
// This ignores the root
func (node *CommitFileNode) GetPathsMatching(test func(*CommitFileNode) bool) []string {
return getPathsMatching(node, func(n INode) bool {
return test(n.(*CommitFileNode))
})
}
func (s *CommitFileNode) GetLeaves() []*CommitFileNode {
leaves := getLeaves(s)
castLeaves := make([]*CommitFileNode, len(leaves))