MCPcopy Create free account
hub / github.com/go-git/go-git / EncodedObjectSize

Method EncodedObjectSize

storage/filesystem/object.go:312–322  ·  view source on GitHub ↗

EncodedObjectSize returns the plaintext size of the given object, without actually reading the full object data from storage.

(h plumbing.Hash)

Source from the content-addressed store, hash-verified

310// EncodedObjectSize returns the plaintext size of the given object,
311// without actually reading the full object data from storage.
312func (s *ObjectStorage) EncodedObjectSize(h plumbing.Hash) (
313 size int64, err error) {
314 size, err = s.encodedObjectSizeFromUnpacked(h)
315 if err != nil && err != plumbing.ErrObjectNotFound {
316 return 0, err
317 } else if err == nil {
318 return size, nil
319 }
320
321 return s.encodedObjectSizeFromPackfile(h)
322}
323
324// EncodedObject returns the object with the given hash, by searching for it in
325// the packfile and the git object directories.

Callers 3

Tested by 3