MCPcopy Index your code
hub / github.com/git-bug/git-bug / makeExtraTree

Method makeExtraTree

entity/dag/operation_pack.go:176–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174}
175
176func (opp *operationPack) makeExtraTree() []repository.TreeEntry {
177 var tree []repository.TreeEntry
178 counter := 0
179 added := make(map[repository.Hash]interface{})
180
181 for _, ops := range opp.Operations {
182 ops, ok := ops.(OperationWithFiles)
183 if !ok {
184 continue
185 }
186
187 for _, file := range ops.GetFiles() {
188 if _, has := added[file]; !has {
189 tree = append(tree, repository.TreeEntry{
190 ObjectType: repository.Blob,
191 Hash: file,
192 // The name is not important here, we only need to
193 // reference the blob.
194 Name: fmt.Sprintf("file%d", counter),
195 })
196 counter++
197 added[file] = struct{}{}
198 }
199 }
200 }
201
202 return tree
203}
204
205// readOperationPack read the operationPack encoded in git at the given Tree hash.
206//

Callers 1

WriteMethod · 0.95

Calls 1

GetFilesMethod · 0.65

Tested by

no test coverage detected