func (idx *Index) Add(h plumbing.Hash, offset uint64, crc32 uint32) {
	e := idxfile.Entry{
		Hash:   h,
		Offset: offset,
		CRC32:  crc32,
	}
	idx.add(&e)
}
Add adds a new Entry with the given values to the index.
package packfile
import (
	"gopkg.in/src-d/go-git.v4/plumbing"
	"gopkg.in/src-d/go-git.v4/plumbing/format/idxfile"
)
type Index struct {
	byHash   map[plumbing.Hash]*idxfile.Entry
	byOffset map[uint64]*idxfile.Entry
}
func NewIndex(size int) *Index {
	return &Index{
		byHash:   make(map[plumbing.Hash]*idxfile.Entry, size),
		byOffset: make(map[uint64]*idxfile.Entry, size),
	}
}
func NewIndexFromIdxFile(idxf *idxfile.Idxfile) *Index {
	idx := &Index{
		byHash:   make(map[plumbing.Hash]*idxfile.Entry, idxf.ObjectCount),
		byOffset: make(map[uint64]*idxfile.Entry, idxf.ObjectCount),
	}
	for _, e := range idxf.Entries {
		idx.add(e)
	}
	return idx
}