Skip to content

Commit

Permalink
fix for parent repository search
Browse files Browse the repository at this point in the history
  • Loading branch information
siewer committed Jun 11, 2024
1 parent adfcb02 commit afe40a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public interface CodeProjectRepository extends JpaRepository<CodeProject, Long>

Optional<CodeProject> findByRepoUrlOrRepoUrl(String repoUrl, String s);

Optional<CodeProject> findByRepoUrlOrRepoUrlAndName(String repoUrl, String s, String name);
List<CodeProject> findByRepoUrlOrRepoUrlAndName(String repoUrl, String s, String name);
List<CodeProject> findBydTrackUuidNotNullAndRepoUrlNotNull();
@Query("select cp from CodeProject cp where cp.remotename is null and cp.repoUrl is not null and cp.dTrackUuid is null")
List<CodeProject> getCodeProjectsForSynchro();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.security.Principal;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -86,8 +87,9 @@ public CodeProject createOrGetCodeProject(String repoUrl, String branch, String
String[] repoUrlParts = repo.getPath().split("/");
String name = repoUrlParts[repoUrlParts.length-1];

Optional<CodeProject> codeProject = codeProjectRepository.findByRepoUrlOrRepoUrlAndName(repoUrl, repoUrl+".git", codeProjectName);
List<CodeProject> codeProjectList = codeProjectRepository.findByRepoUrlOrRepoUrlAndName(repoUrl, repoUrl+".git", codeProjectName);

Optional<CodeProject> codeProject = codeProjectList.stream().filter(cp -> cp.getParent() == null).findFirst();
if (codeProject.isPresent()){
getOrCreateCodeProjectBranchService.getOrCreateCodeProjectBranch(codeProject.get(), branch);
return codeProject.get();
Expand Down

0 comments on commit afe40a5

Please sign in to comment.