<commit_before>package org.jsync.sync;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.NoFilepatternException;
import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.errors.AmbiguousObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.RevisionSyntaxException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.treewalk.TreeWalk;

import lombok.Getter;
import lombok.val;

/**
 * This class is used to sync all your resources with the local git server. The
 * branch master is used to push commits to every change you make.
 * 
 * @author Dragos
 *
 */
public abstract class Updater {
	@Getter
	protected final String localPath;
	protected final Git git;
	protected final String branch;
	protected final Repository repository;

	/**
	 * Create a new Updater with the path set to the res folder, which is default
	 * 
	 * @throws IOException
	 * @throws NoFilepatternException
	 * @throws GitAPIException
	 */
	public Updater() throws IOException, NoFilepatternException, GitAPIException {
		this("res", "master");
	}

	/**
	 * Create a new Updater with the given local path.
	 * 
	 * @param localFolder
	 *            The local path you want to sync with.
	 * @param branch
	 *            The main branch to keep the data on locally.
	 * @throws IOException
	 * @throws NoFilepatternException
	 * @throws GitAPIException
	 */
	public Updater(String localFolder, String branch) throws IOException, NoFilepatternException, GitAPIException {
		localPath = localFolder;
		this.branch = branch;
		val repositoryFolder = new File(localFolder, ".git");
		repository = FileRepositoryBuilder.create(repositoryFolder);
		try {
			repository.create();
		} catch (IllegalStateException e) {<commit_msg>set default folder again<commit_after>package org.jsync.sync;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.NoFilepatternException;
import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.errors.AmbiguousObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.RevisionSyntaxException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.treewalk.TreeWalk;

import lombok.Getter;
import lombok.val;

/**
 * This class is used to sync all your resources with the local git server. The
 * branch master is used to push commits to every change you make.
 * 
 * @author Dragos
 *
 */
public abstract class Updater {
	@Getter
	protected final String localPath;
	protected final Git git;
	protected final String branch;
	protected final Repository repository;

	/**
	 * Create a new Updater with the path set to the res folder, which is default
	 * 
	 * @throws IOException
	 * @throws NoFilepatternException
	 * @throws GitAPIException
	 */
	public Updater() throws IOException, NoFilepatternException, GitAPIException {
		this("assets", "master");
	}

	/**
	 * Create a new Updater with the given local path.
	 * 
	 * @param localFolder
	 *            The local path you want to sync with.
	 * @param branch
	 *            The main branch to keep the data on locally.
	 * @throws IOException
	 * @throws NoFilepatternException
	 * @throws GitAPIException
	 */
	public Updater(String localFolder, String branch) throws IOException, NoFilepatternException, GitAPIException {
		localPath = localFolder;
		this.branch = branch;
		val repositoryFolder = new File(localFolder, ".git");
		repository = FileRepositoryBuilder.create(repositoryFolder);
		try {
			repository.create();
		} catch (IllegalStateException e) {
{'fraction_non_alphanumeric': 0.09196787148594378, 'fraction_numerical': 0.0, 'mean_word_length': 4.673120728929385, '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': '3618782', 'n_tokens_mistral': 1494, 'n_tokens_neox': 1435, 'n_words': 391}