<commit_before>package git

/*
#cgo pkg-config: libgit2
#include <git2.h>
#include <git2/errors.h>
*/
import "C"
import "runtime"

type ObjectType int

var (
	OBJ_ANY ObjectType = C.GIT_OBJ_ANY
	OBJ_BAD ObjectType = C.GIT_OBJ_BAD
	OBJ_COMMIT ObjectType = C.GIT_OBJ_COMMIT
	OBJ_TREE ObjectType = C.GIT_OBJ_TREE
	OBJ_BLOB ObjectType = C.GIT_OBJ_BLOB
	OBJ_TAG ObjectType = C.GIT_OBJ_TAG
)

type Object interface {
	Free()
	Id() *Oid
	Type() ObjectType
}

type gitObject struct {
	ptr *C.git_object
}

func (o gitObject) Id() *Oid {
	return newOidFromC(C.git_commit_id(o.ptr))
}
<commit_msg>Add String() Method to ObjectType<commit_after>package git

/*
#cgo pkg-config: libgit2
#include <git2.h>
#include <git2/errors.h>
*/
import "C"
import "runtime"

type ObjectType int

var (
	OBJ_ANY ObjectType = C.GIT_OBJ_ANY
	OBJ_BAD ObjectType = C.GIT_OBJ_BAD
	OBJ_COMMIT ObjectType = C.GIT_OBJ_COMMIT
	OBJ_TREE ObjectType = C.GIT_OBJ_TREE
	OBJ_BLOB ObjectType = C.GIT_OBJ_BLOB
	OBJ_TAG ObjectType = C.GIT_OBJ_TAG
)

type Object interface {
	Free()
	Id() *Oid
	Type() ObjectType
}

type gitObject struct {
	ptr *C.git_object
}

func (t ObjectType) String() (string) {
	switch (t) {
	case OBJ_ANY:
		return "Any"
	case OBJ_BAD:
		return "Bad"
	case OBJ_COMMIT:
		return "Commit"
	case OBJ_TREE:
		return "Tree"
	case OBJ_BLOB:
		return "Blob"
	case OBJ_TAG:
		return "tag"
	}
	// Never reached
	return ""
}

func (o gitObject) Id() *Oid {
	return newOidFromC(C.git_commit_id(o.ptr))
}

{'fraction_non_alphanumeric': 0.109979633401222, 'fraction_numerical': 0.004073319755600814, 'mean_word_length': 4.340579710144928, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3124805', 'n_tokens_mistral': 658, 'n_tokens_neox': 631, 'n_words': 148}