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

Function NewEncoder

plumbing/format/packfile/encoder.go:29–43  ·  view source on GitHub ↗

NewEncoder creates a new packfile encoder using a specific Writer and EncodedObjectStorer. By default deltas used to generate the packfile will be OFSDeltaObject. To use Reference deltas, set useRefDeltas to true.

(w io.Writer, s storer.EncodedObjectStorer, useRefDeltas bool)

Source from the content-addressed store, hash-verified

27// EncodedObjectStorer. By default deltas used to generate the packfile will be
28// OFSDeltaObject. To use Reference deltas, set useRefDeltas to true.
29func NewEncoder(w io.Writer, s storer.EncodedObjectStorer, useRefDeltas bool) *Encoder {
30 h := plumbing.Hasher{
31 Hash: hash.New(hash.CryptoType),
32 }
33 mw := io.MultiWriter(w, h)
34 ow := newOffsetWriter(mw)
35 zw := zlib.NewWriter(mw)
36 return &Encoder{
37 selector: newDeltaSelector(s),
38 w: ow,
39 zw: zw,
40 hasher: h,
41 useRefDeltas: useRefDeltas,
42 }
43}
44
45// Encode creates a packfile containing all the objects referenced in
46// hashes and writes it to the writer in the Encoder. `packWindow`

Calls 3

NewFunction · 0.92
newOffsetWriterFunction · 0.85
newDeltaSelectorFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…