MCPcopy
hub / github.com/go-git/go-git / Decode

Method Decode

plumbing/format/index/decoder.go:66–83  ·  view source on GitHub ↗

Decode reads the whole index object from its input and stores it in the value pointed to by idx.

(idx *Index)

Source from the content-addressed store, hash-verified

64// Decode reads the whole index object from its input and stores it in the
65// value pointed to by idx.
66func (d *Decoder) Decode(idx *Index) error {
67 var err error
68 idx.Version, err = validateHeader(d.r)
69 if err != nil {
70 return err
71 }
72
73 entryCount, err := binary.ReadUint32(d.r)
74 if err != nil {
75 return err
76 }
77
78 if err := d.readEntries(idx, int(entryCount)); err != nil {
79 return err
80 }
81
82 return d.readExtensions(idx)
83}
84
85func (d *Decoder) readEntries(idx *Index, count int) error {
86 for i := 0; i < count; i++ {

Callers 15

IndexMethod · 0.95
loadIdxFileMethod · 0.95
readExtensionMethod · 0.95
TestEncodeMethod · 0.95
TestEncodeV4Function · 0.95
TestDecodeMethod · 0.95
TestDecodeEntriesMethod · 0.95
TestDecodeCacheTreeMethod · 0.95
TestDecodeExtendedV3Method · 0.95

Calls 4

readEntriesMethod · 0.95
readExtensionsMethod · 0.95
ReadUint32Function · 0.92
validateHeaderFunction · 0.70

Tested by 15

TestEncodeMethod · 0.76
TestEncodeV4Function · 0.76
TestDecodeMethod · 0.76
TestDecodeEntriesMethod · 0.76
TestDecodeCacheTreeMethod · 0.76
TestDecodeExtendedV3Method · 0.76
TestDecodeResolveUndoMethod · 0.76
TestDecodeV4Method · 0.76