#16 -- Clear previous commits

This commit is contained in:
Anton Romanov 2021-03-29 17:11:07 +04:00
parent 50bc8aee9e
commit fb068f7b2a

View File

@ -48,6 +48,8 @@ public class IndexService {
branchRepository.save(new Branch(repository, branchName)); branchRepository.save(new Branch(repository, branchName));
} }
List<Commit> commits = gitRepositoryService.getCommits(repositoryUrl, branchName); List<Commit> commits = gitRepositoryService.getCommits(repositoryUrl, branchName);
commitRepository.deleteAll(branch.getCommits());
branch.getCommits().clear();
branch.setCommits(commits); branch.setCommits(commits);
branchRepository.save(branch); branchRepository.save(branch);
gitRepositoryService.remove(repositoryUrl); gitRepositoryService.remove(repositoryUrl);