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

Method encodeGenerationV2Data

plumbing/format/commitgraph/v2/encoder.go:218–236  ·  view source on GitHub ↗
(generationV2Data []uint64)

Source from the content-addressed store, hash-verified

216}
217
218func (e *Encoder) encodeGenerationV2Data(generationV2Data []uint64) (overflows []uint64, err error) {
219 head := 0
220 for _, data := range generationV2Data {
221 if data >= 0x80000000 {
222 // overflow
223 if err = binary.WriteUint32(e, uint32(head)|0x80000000); err != nil {
224 return nil, err
225 }
226 generationV2Data[head] = data
227 head++
228 continue
229 }
230 if err = binary.WriteUint32(e, uint32(data)); err != nil {
231 return nil, err
232 }
233 }
234
235 return generationV2Data[:head], nil
236}
237
238func (e *Encoder) encodeGenerationV2Overflow(overflows []uint64) (err error) {
239 for _, overflow := range overflows {

Callers 1

EncodeMethod · 0.95

Calls 1

WriteUint32Function · 0.92

Tested by

no test coverage detected