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

Method LazyWriter

storage/filesystem/object.go:153–160  ·  view source on GitHub ↗

LazyWriter returns a lazy ObjectWriter that is bound to a DotGit file. It first write the header passing on the object type and size, so that the object contents can be written later, without the need to create a MemoryObject and buffering its entire contents into memory.

()

Source from the content-addressed store, hash-verified

151// that the object contents can be written later, without the need to
152// create a MemoryObject and buffering its entire contents into memory.
153func (s *ObjectStorage) LazyWriter() (w io.WriteCloser, wh func(typ plumbing.ObjectType, sz int64) error, err error) {
154 ow, err := s.dir.NewObject()
155 if err != nil {
156 return nil, nil, err
157 }
158
159 return ow, ow.WriteHeader, nil
160}
161
162// HasEncodedObject returns nil if the object exists, without actually
163// reading the object data from storage.

Callers

nothing calls this directly

Calls 1

NewObjectMethod · 0.80

Tested by

no test coverage detected