MCPcopy Create free account
hub / github.com/antonmedv/gitmal / findOrCreateDir

Function findOrCreateDir

commit.go:308–317  ·  view source on GitHub ↗
(parent *templates.FileTree, name, path string)

Source from the content-addressed store, hash-verified

306}
307
308func findOrCreateDir(parent *templates.FileTree, name, path string) *templates.FileTree {
309 for _, ch := range parent.Children {
310 if ch.IsDir && ch.Name == name {
311 return ch
312 }
313 }
314 node := &templates.FileTree{IsDir: true, Name: name, Path: path}
315 parent.Children = append(parent.Children, node)
316 return node
317}
318
319func sortNode(n *templates.FileTree) {
320 if len(n.Children) == 0 {

Callers 1

buildFileTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected