| 174 | } |
| 175 | |
| 176 | func (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 | // |