code: func New(db *gitobj.ObjectDatabase, t *gitobj.Tree) (*Tree, error) {
  	children := make(map[string]*Tree)
  	lines, _, err := linesInTree(db, t)
  	if err != nil {
  		return nil, err
  	}
  
  	for _, entry := range t.Entries {
  		if entry.Type() != gitobj.TreeObjectType {
  			continue
  		}
  
  		// For every entry in the current tree, parse its sub-trees to
  		// see if they might contain a .gitattributes.
  		t, err := db.Tree(entry.Oid)
  		if err != nil {
  			return nil, err
  		}
  
  		at, err := New(db, t)
  		if err != nil {
  			return nil, err
  		}
  
  		if len(at.Children) > 0 || len(at.Lines) > 0 {
  			// Only include entries that have either (1) a
  			// .gitattributes in their tree, or (2) a .gitattributes
  			// in a sub-tree.
  			children[entry.Name] = at
  		}
  	}
  
  	return &Tree{
  		Lines:    lines,
  		Children: children,
  	}, nil
  }
docs: // New constructs a *Tree starting at the given tree "t" and reading objects
  // from the given ObjectDatabase. If a tree was not able to be read, an error
  // will be propagated up accordingly.