<commit_before>package revok_test

import (
	"cred-alert/revok"
	"io/ioutil"
	"os"
	"path/filepath"
	"time"

	git "github.com/libgit2/git2go"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestRevok(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Revok Suite")
}

type createCommitResult struct {
	From *git.Oid
	To   *git.Oid
}

func createCommit(refName, repoPath, filePath string, contents []byte, commitMsg string, parentOid *git.Oid) createCommitResult {
	err := ioutil.WriteFile(filepath.Join(repoPath, filePath), contents, os.ModePerm)

	repo, err := git.OpenRepository(repoPath)
	Expect(err).NotTo(HaveOccurred())
	defer repo.Free()

	if parentOid == nil {
		referenceIterator, err := repo.NewReferenceIterator()
		Expect(err).NotTo(HaveOccurred())
		defer referenceIterator.Free()
<commit_msg>Silence grpc logger in test<commit_after>package revok_test

import (
	"cred-alert/revok"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"time"

	"google.golang.org/grpc/grpclog"

	git "github.com/libgit2/git2go"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func init() {
	grpclog.SetLogger(log.New(ioutil.Discard, "", 0))
}

func TestRevok(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Revok Suite")
}

type createCommitResult struct {
	From *git.Oid
	To   *git.Oid
}

func createCommit(refName, repoPath, filePath string, contents []byte, commitMsg string, parentOid *git.Oid) createCommitResult {
	err := ioutil.WriteFile(filepath.Join(repoPath, filePath), contents, os.ModePerm)

	repo, err := git.OpenRepository(repoPath)
	Expect(err).NotTo(HaveOccurred())
	defer repo.Free()

	if parentOid == nil {
		referenceIterator, err := repo.NewReferenceIterator()
		Expect(err).NotTo(HaveOccurred())
		defer referenceIterator.Free()

{'fraction_non_alphanumeric': 0.14135254988913526, 'fraction_numerical': 0.002771618625277162, 'mean_word_length': 5.097972972972973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4613573', 'n_tokens_mistral': 708, 'n_tokens_neox': 694, 'n_words': 128}