Index entries are padded out to the next 8 byte alignment for historical reasons related to how C Git read the files.
(idx *Index, e *Entry, read int)
| 195 | // Index entries are padded out to the next 8 byte alignment |
| 196 | // for historical reasons related to how C Git read the files. |
| 197 | func (d *Decoder) padEntry(idx *Index, e *Entry, read int) error { |
| 198 | if idx.Version == 4 { |
| 199 | return nil |
| 200 | } |
| 201 | |
| 202 | entrySize := read + len(e.Name) |
| 203 | padLen := 8 - entrySize%8 |
| 204 | _, err := io.CopyN(io.Discard, d.r, int64(padLen)) |
| 205 | return err |
| 206 | } |
| 207 | |
| 208 | func (d *Decoder) readExtensions(idx *Index) error { |
| 209 | // TODO: support 'Split index' and 'Untracked cache' extensions, take in |