<commit_before>package no.uio.ifi.trackfind.backend.configuration;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Configuration
public class BeanDefinitions {

    private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";

    private TrackFindProperties properties;

    @Bean
    public Gson gson() {
        return new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().setDateFormat(DATE_FORMAT).create();
    }

    @Bean
    public Git git() throws IOException, GitAPIException {
        FileUtils.deleteDirectory(new File(properties.getArchiveFolder()));
        Git git = Git.init().setDirectory(new File(properties.getIndicesFolder())).call();
        try {
            git.log().call();
        } catch (NoHeadException e) {
            git.add().addFilepattern(".").call();
            git.commit().setMessage("Initial commit.").call();
        }
        return git;<commit_msg>Add .gitattributes to indices repo.<commit_after>package no.uio.ifi.trackfind.backend.configuration;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Configuration
public class BeanDefinitions {

    private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";

    private TrackFindProperties properties;

    @Bean
    public Gson gson() {
        return new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().setDateFormat(DATE_FORMAT).create();
    }

    @Bean
    public Git git() throws IOException, GitAPIException {
        FileUtils.deleteDirectory(new File(properties.getArchiveFolder()));
        Git git = Git.init().setDirectory(new File(properties.getIndicesFolder())).call();
        try {
            git.log().call();
        } catch (NoHeadException e) {
            FileUtils.write(new File(properties.getIndicesFolder() + ".gitattributes"), "*.* filter=lfs diff=lfs merge=lfs -text", Charset.defaultCharset());
            git.add().addFilepattern(".").call();
            git.commit().setMessage("Initial commit.").call();
        }
        return git;
{'fraction_non_alphanumeric': 0.11502535361622632, 'fraction_numerical': 0.0, 'mean_word_length': 4.544378698224852, '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': '6348893', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1017, 'n_words': 185}