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)
| 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). |
| 226 | func (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 | |
| 241 | func (d *Decoder) readExtensions(idx *Index) error { |
| 242 | // TODO: support 'Split index' and 'Untracked cache' extensions, take in |