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

Method Encode

plumbing/format/index/encoder.go:37–53  ·  view source on GitHub ↗

Encode writes the Index to the stream of the encoder.

(idx *Index)

Source from the content-addressed store, hash-verified

35
36// Encode writes the Index to the stream of the encoder.
37func (e *Encoder) Encode(idx *Index) error {
38 // TODO: support v4
39 // TODO: support extensions
40 if idx.Version > EncodeVersionSupported {
41 return ErrUnsupportedVersion
42 }
43
44 if err := e.encodeHeader(idx); err != nil {
45 return err
46 }
47
48 if err := e.encodeEntries(idx); err != nil {
49 return err
50 }
51
52 return e.encodeFooter()
53}
54
55func (e *Encoder) encodeHeader(idx *Index) error {
56 return binary.Write(e.w,

Callers 15

createNewObjectPackMethod · 0.95
pushHashesFunction · 0.95
SetIndexMethod · 0.95
encodeIdxMethod · 0.95
EncodeMethod · 0.95
TestDecodeMethod · 0.95
TestDecodeWithErrorMethod · 0.95
TestDecodeWithPendingMethod · 0.95

Calls 3

encodeHeaderMethod · 0.95
encodeEntriesMethod · 0.95
encodeFooterMethod · 0.95