aboutsummaryrefslogtreecommitdiffstats
path: root/file.go
diff options
context:
space:
mode:
authorJoshua Sjoding <joshua.sjoding@scjalliance.com>2016-03-03 00:33:00 -0800
committerJoshua Sjoding <joshua.sjoding@scjalliance.com>2016-03-08 13:09:54 -0800
commit9e6a03b7956464ccd9d2fbacedd8e5cc23572d02 (patch)
tree0282f20de8279db354233d1d67e3743e08509020 /file.go
parent9c9cdff966cc181296f400769d3c8596f17e743a (diff)
downloadgo-git-9e6a03b7956464ccd9d2fbacedd8e5cc23572d02.tar.gz
Added Object interface for Commit, Tree, Blob and Tag
* New Object interface is distinct from core.Object * New Object interface is used in places where returned object could be of any type * Object is implemented by Commit, Tree, Blob, File and Tag * Added Repository.Object function for retrieving objects of any type * Tag.Object now returns Object instead of core.Object * Tag target hash is now publicly accessible * Renamed Tag.Type field to Tag.TargetType, making it distinct from Tag.Type function * Fixed infinite recursive loop in TagIter.Close * TreeWalker.Next now returns Object instead of core.Object * Removed some duplicate test setup code
Diffstat (limited to 'file.go')
-rw-r--r--file.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/file.go b/file.go
index e3e8e93..76ec962 100644
--- a/file.go
+++ b/file.go
@@ -3,8 +3,6 @@ package git
import (
"bytes"
"strings"
-
- "gopkg.in/src-d/go-git.v3/core"
)
// File represents git file objects.
@@ -64,15 +62,9 @@ func (iter *FileIter) Next() (*File, error) {
return nil, err
}
- if obj.Type() != core.BlobObject {
- // Skip non-blob objects
- continue
+ if blob, ok := obj.(*Blob); ok {
+ return newFile(name, blob), nil
}
-
- blob := &Blob{}
- blob.Decode(obj)
-
- return newFile(name, blob), nil
}
}