<commit_before>package fusetest

import (
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"testing"

	. "github.com/smartystreets/goconvey/convey"
)

func testGitClone(t *testing.T, mountDir string) {
	Convey("Git", t, createDir(mountDir, "GitClone", func(dirPath string) {
		Convey("It should clone repo", func() {
			clone := func(dir string) error {
				cmd := exec.Command("git", "clone", "-q", "https://github.com/sent-hil/bitesized", dir)
				_, err := cmd.Output()
				return err
			}

			md5 := func(dir string) (string, error) {
				cmd := exec.Command("bash", "-c", fmt.Sprintf("ls %s | md5sum", dir))
				output, err := cmd.Output()

				return string(output), err
			}

			So(clone(dirPath), ShouldBeNil)

			Convey("It should compare contents of mount & outside repos", func() {
				// clone git repo to outside mount
				temp, err := ioutil.TempDir("", "")
				So(err, ShouldBeNil)

				So(clone(temp), ShouldBeNil)

				// compare if md5 of inside mount repo is same as outside mount repo
				ta, err := md5(filepath.Join(dirPath, "bitesized"))
				So(err, ShouldBeNil)

				tb, err := md5(filepath.Join(temp, "bitesized"))
				So(err, ShouldBeNil)

				So(ta, ShouldEqual, tb)

				Reset(func() { os.RemoveAll(temp) })
			})<commit_msg>fusetest: switch to md5 instead of md5sum<commit_after>package fusetest

import (
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"testing"

	. "github.com/smartystreets/goconvey/convey"
)

func testGitClone(t *testing.T, mountDir string) {
	Convey("Git", t, createDir(mountDir, "GitClone", func(dirPath string) {
		Convey("It should clone repo", func() {
			clone := func(dir string) error {
				cmd := exec.Command("git", "clone", "-q", "https://github.com/sent-hil/bitesized", dir)
				_, err := cmd.Output()
				return err
			}

			md5 := func(dir string) (string, error) {
				cmd := exec.Command("bash", "-c", fmt.Sprintf("ls %s | md5", dir))
				output, err := cmd.Output()

				return string(output), err
			}

			So(clone(dirPath), ShouldBeNil)

			Convey("It should compare contents of mount & outside repos", func() {
				// clone git repo to outside mount
				temp, err := ioutil.TempDir("", "")
				So(err, ShouldBeNil)

				So(clone(temp), ShouldBeNil)

				// compare if md5 of inside mount repo is same as outside mount repo
				ta, err := md5(filepath.Join(dirPath, "bitesized"))
				So(err, ShouldBeNil)

				tb, err := md5(filepath.Join(temp, "bitesized"))
				So(err, ShouldBeNil)

				So(ta, ShouldEqual, tb)

				Reset(func() { os.RemoveAll(temp) })
			})
{'fraction_non_alphanumeric': 0.16319307904050334, 'fraction_numerical': 0.0047188360204482895, 'mean_word_length': 3.4710017574692444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2948787', 'n_tokens_mistral': 1064, 'n_tokens_neox': 906, 'n_words': 230}