From 3c6073d711bdfac534f807bb5a2151ae9cb31e0e Mon Sep 17 00:00:00 2001 From: Declan Lynch Date: Fri, 7 Jul 2023 08:56:51 -0400 Subject: [PATCH] Restrict list of detected branches to remote only to avoid duplication of the main/master branch --- .../nl/avisi/structurizr/site/generatr/ClonedRepository.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/ClonedRepository.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/ClonedRepository.kt index 04c5a5eb..8ec97f2e 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/ClonedRepository.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/ClonedRepository.kt @@ -3,7 +3,6 @@ package nl.avisi.structurizr.site.generatr import org.eclipse.jgit.api.CreateBranchCommand import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.ListBranchCommand -import org.eclipse.jgit.lib.Ref import org.eclipse.jgit.storage.file.FileRepositoryBuilder import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider import java.io.File @@ -52,7 +51,7 @@ class ClonedRepository( } fun getBranchNames(excludeBranches: List) = - Git(repo).branchList().setListMode(ListBranchCommand.ListMode.ALL).call() + Git(repo).branchList().setListMode(ListBranchCommand.ListMode.REMOTE).call() .map { it.name.toString().substringAfterLast("/") } .onEach { println("Found the following branch: $it") } .filter { it !in excludeBranches }