MCPcopy Index your code
hub / github.com/go-git/go-git / toObject

Method toObject

plumbing/object/object.go:222–239  ·  view source on GitHub ↗
(obj plumbing.EncodedObject)

Source from the content-addressed store, hash-verified

220}
221
222func (iter *ObjectIter) toObject(obj plumbing.EncodedObject) (Object, error) {
223 switch obj.Type() {
224 case plumbing.BlobObject:
225 blob := &Blob{}
226 return blob, blob.Decode(obj)
227 case plumbing.TreeObject:
228 tree := &Tree{s: iter.s}
229 return tree, tree.Decode(obj)
230 case plumbing.CommitObject:
231 commit := &Commit{}
232 return commit, commit.Decode(obj)
233 case plumbing.TagObject:
234 tag := &Tag{}
235 return tag, tag.Decode(obj)
236 default:
237 return nil, plumbing.ErrInvalidType
238 }
239}

Callers 2

NextMethod · 0.95
ForEachMethod · 0.95

Calls 5

DecodeMethod · 0.95
DecodeMethod · 0.95
DecodeMethod · 0.95
DecodeMethod · 0.95
TypeMethod · 0.65

Tested by

no test coverage detected