<commit_before>package com.benromberg.cordonbleu.service.coderepository;

import static com.benromberg.cordonbleu.util.CollectionUtil.toStream;
import static com.benromberg.cordonbleu.util.ExceptionUtil.convertException;
import static java.util.stream.Collectors.toList;
import com.benromberg.cordonbleu.data.model.Commit;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.IntStream;

import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.diff.DiffFormatter;
import org.eclipse.jgit.diff.RawTextComparator;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.util.io.DisabledOutputStream;

import com.ibm.icu.text.CharsetDetector;

public class GitCommitDetail {
    private static final int BINARY_FILE_CONTROL_CHARACTER_FACTOR = 100;
    private static final String BINARY_FILE_REPLACEMENT = "Binary file content with MD5 checksum %s";
    private static final int BINARY_ANALYSIS_LIMIT = 100_000_000;

    private final Repository repository;

    public GitCommitDetail(Repository repository) {
        this.repository = repository;
    }

    public CommitDetail getCommitDetail(Commit commit) {
        try (RevWalk walk = new RevWalk(repository)) {
            RevCommit revCommit = convertException(() -> walk.parseCommit(repository.resolve(commit.getId().getHash())));
            return new CommitDetail(commit, getCommitFiles(walk, revCommit));
        } catch (IOException e) {<commit_msg>Revert "Increasing binary analysis size limit to 100_000_000"<commit_after>package com.benromberg.cordonbleu.service.coderepository;

import static com.benromberg.cordonbleu.util.CollectionUtil.toStream;
import static com.benromberg.cordonbleu.util.ExceptionUtil.convertException;
import static java.util.stream.Collectors.toList;
import com.benromberg.cordonbleu.data.model.Commit;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.IntStream;

import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.diff.DiffFormatter;
import org.eclipse.jgit.diff.RawTextComparator;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.util.io.DisabledOutputStream;

import com.ibm.icu.text.CharsetDetector;

public class GitCommitDetail {
    private static final int BINARY_FILE_CONTROL_CHARACTER_FACTOR = 100;
    private static final String BINARY_FILE_REPLACEMENT = "Binary file content with MD5 checksum %s";
    private static final int BINARY_ANALYSIS_LIMIT = 100000;

    private final Repository repository;

    public GitCommitDetail(Repository repository) {
        this.repository = repository;
    }

    public CommitDetail getCommitDetail(Commit commit) {
        try (RevWalk walk = new RevWalk(repository)) {
            RevCommit revCommit = convertException(() -> walk.parseCommit(repository.resolve(commit.getId().getHash())));
            return new CommitDetail(commit, getCommitFiles(walk, revCommit));
        } catch (IOException e) {
{'fraction_non_alphanumeric': 0.09510942988381518, 'fraction_numerical': 0.008646311807619562, 'mean_word_length': 5.0688524590163935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5941487', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1132, 'n_words': 223}