func InitRepoConf(t *testing.T, r *git.Repository) {
	c, err := r.Config()
	require.NoError(t, err)
	require.NoError(t, c.SetString("user.name", GIT_USERNAME))
	require.NoError(t, c.SetString("user.email", GIT_EMAIL))
}
InitRepoConf set the repository initial configuration
package test
import (
	"io/ioutil"
	"os"
	"path/filepath"
	"testing"
	git "github.com/libgit2/git2go/v31"
	"github.com/stretchr/testify/require"
)
const (
	GIT_USERNAME = "Alice"
	GIT_EMAIL    = "alice@ecorp.com"
)
func TestRepo(t *testing.T) (repo *git.Repository) {
	path, err := ioutil.TempDir("", "turbogit")
	require.NoError(t, err)
	r, err := git.InitRepository(path, false)
	require.NoError(t, err)
	require.NoError(t, os.Chdir(path))
	return r
}
func CleanupRepo(t *testing.T, r *git.Repository) {
	p := r.Workdir()
	if r.IsBare() {
		p = r.Path()
	}
	require.NoError(t, os.RemoveAll(p))
}
func NewFile(t *testing.T, r *git.Repository) *os.File {
	f, err := ioutil.TempFile(r.Workdir(), "")
	require.NoError(t, err)
	return f
}
func StageFile(t *testing.T, f *os.File, r *git.Repository) {
	frel, err := filepath.Rel(r.Workdir(), f.Name())
	require.NoError(t, err)
	idx, err := r.Index()
	require.NoError(t, err)
	require.NoError(t, idx.AddByPath(frel))
}
func StageNewFile(t *testing.T, r *git.Repository) {
	StageFile(t, NewFile(t, r), r)
}