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

Method padEntry

plumbing/format/index/decoder.go:226–239  ·  view source on GitHub ↗

padEntry discards NUL padding bytes that follow each V2/V3 entry on disk. nameConsumed is the number of stream bytes consumed while reading the entry name (which may exceed len(e.Name) when a NUL terminator was consumed for long names where the 12-bit length field overflowed).

(idx *Index, e *Entry, read, nameConsumed int)

Source from the content-addressed store, hash-verified

224// the entry name (which may exceed len(e.Name) when a NUL terminator was
225// consumed for long names where the 12-bit length field overflowed).
226func (d *Decoder) padEntry(idx *Index, e *Entry, read, nameConsumed int) error {
227 if idx.Version == 4 {
228 return nil
229 }
230
231 entrySize := read + len(e.Name)
232 padLen := 8 - entrySize%8
233 padLen -= nameConsumed - len(e.Name)
234 if padLen > 0 {
235 _, err := io.CopyN(io.Discard, d.r, int64(padLen))
236 return err
237 }
238 return nil
239}
240
241func (d *Decoder) readExtensions(idx *Index) error {
242 // TODO: support 'Split index' and 'Untracked cache' extensions, take in

Callers 1

readEntryMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected