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

@@ -162,16 +162,16 @@ func (cmd CmdCat) Execute(args []string) error {
return err
case "blob":
_, blobType, _, length, err := repo.Index().Lookup(id)
blob, err := repo.Index().Lookup(id)
if err != nil {
return err
}
if blobType != pack.Data {
if blob.Type != pack.Data {
return errors.New("wrong type for blob")
}
buf := make([]byte, length)
buf := make([]byte, blob.Length)
data, err := repo.LoadBlob(pack.Data, id, buf)
if err != nil {
return err