func NewIndex() (*Index, error) {
	var ptr *C.git_index
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	if err := C.git_index_new(&ptr); err < 0 {
		return nil, MakeGitError(err)
	}
	return newIndexFromC(ptr), nil
}
NewIndex allocates a new index. It won't be associated with any
file on the filesystem or repository
package git
import "C"
import (
	"fmt"
	"runtime"
	"unsafe"
)
type IndexMatchedPathCallback func(string, string) int
type IndexAddOpts uint
const (
	IndexAddDefault              IndexAddOpts = C.GIT_INDEX_ADD_DEFAULT
	IndexAddForce                IndexAddOpts = C.GIT_INDEX_ADD_FORCE
	IndexAddDisablePathspecMatch IndexAddOpts = C.GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH
	IndexAddCheckPathspec        IndexAddOpts = C.GIT_INDEX_ADD_CHECK_PATHSPEC
)
type Index struct {
	ptr *C.git_index
}
type IndexTime struct {
	seconds     int32
	nanoseconds uint32
}
type IndexEntry struct {
	Ctime IndexTime
	Mtime IndexTime
	Mode  Filemode
	Uid   uint32
	Gid   uint32
	Size  uint32
	Id    *Oid
	Path  string
}
func newIndexEntryFromC(entry *C.git_index_entry) *IndexEntry {
	if entry == nil {
		return nil
	}
	return &IndexEntry{
		IndexTime { int32(entry.ctime.seconds), uint32(entry.ctime.nanoseconds) },
		IndexTime { int32(entry.mtime.seconds), uint32(entry.mtime.nanoseconds) },
		Filemode(entry.mode),
		uint32(entry.uid),
		uint32(entry.gid),
		uint32(entry.file_size),
		newOidFromC(&entry.id),
		C.GoString(entry.path),
	}
}
func populateCIndexEntry(source *IndexEntry, dest *C.git_index_entry) {
	dest.ctime.seconds = C.int32_t(source.Ctime.seconds)
	dest.ctime.nanoseconds = C.uint32_t(source.Ctime.nanoseconds)
	dest.mtime.seconds = C.int32_t(source.Mtime.seconds)
	dest.mtime.nanoseconds = C.uint32_t(source.Mtime.nanoseconds)
	dest.mode = C.uint32_t(source.Mode)
	dest.uid = C.uint32_t(source.Uid)
	dest.gid = C.uint32_t(source.Gid)
	dest.file_size = C.uint32_t(source.Size)
	dest.id = *source.Id.toC()
	dest.path = C.CString(source.Path)
}
func freeCIndexEntry(entry *C.git_index_entry) {
	C.free(unsafe.Pointer(entry.path))
}
func newIndexFromC(ptr *C.git_index) *Index {
	idx := &Index{ptr}
	runtime.SetFinalizer(idx, (*Index).Free)
	return idx
}