(tree *git.Tree)
| 9 | ) |
| 10 | |
| 11 | func (p *Project) mapFromTree(tree *git.Tree) (docs map[string]*pb.Document, err error) { |
| 12 | var walkErr error |
| 13 | docs = make(map[string]*pb.Document, tree.EntryCount()) |
| 14 | err = tree.Walk(func(path string, entry *git.TreeEntry) int { |
| 15 | // add objects to deployment |
| 16 | if entry.Type == git.ObjectBlob { |
| 17 | doc, err := p.getDocument(entry.Id) |
| 18 | if err != nil { |
| 19 | walkErr = err |
| 20 | return -1 |
| 21 | } |
| 22 | |
| 23 | path = path + entry.Name |
| 24 | docs[path] = doc |
| 25 | if walkErr != nil { |
| 26 | return -1 |
| 27 | } |
| 28 | } |
| 29 | return 0 |
| 30 | }) |
| 31 | |
| 32 | if err != nil { |
| 33 | err = fmt.Errorf("error starting walk: %v", err) |
| 34 | } else if walkErr != nil { |
| 35 | err = fmt.Errorf("error during walk: %v", walkErr) |
| 36 | } |
| 37 | return |
| 38 | } |
no test coverage detected