initRepository(pullRequest.fromProject,
StringUtils.removeStart(pullRequest.fromBranch, "refs/heads/"), "2.txt");
}
private void initRepository(Project project, String branchName, String fileName) throws Exception {
GitRepository gitRepository = new GitRepository(project);
gitRepository.create();
Repository repository = GitRepository.buildMergingRepository(project);
Git git = new Git(repository);
FileUtils.touch(new File(GitRepository.getDirectoryForMerging(project.owner, project.name + "/" + fileName)));
git.add().addFilepattern(fileName).call();
git.commit().setMessage(fileName).call();
git.push().setRefSpecs(new RefSpec("master:master"), new RefSpec("master:" + branchName)).call();
gitRepository.close();
repository.close();
}