Refactor Index.Lookup() to return struct PackedBlob

This commit is contained in:
Alexander Neumann
2015-10-31 14:47:42 +01:00
parent fc0f5d8f72
commit fccde030d5
6 changed files with 90 additions and 71 deletions

View File

@@ -212,14 +212,14 @@ func (node Node) createFileAt(path string, repo *repository.Repository) error {
var buf []byte
for _, id := range node.Content {
_, _, _, length, err := repo.Index().Lookup(id)
blob, err := repo.Index().Lookup(id)
if err != nil {
return err
}
buf = buf[:cap(buf)]
if uint(len(buf)) < length {
buf = make([]byte, length)
if uint(len(buf)) < blob.Length {
buf = make([]byte, blob.Length)
}
buf, err := repo.LoadBlob(pack.Data, id, buf)