Skip to content

Commit

Permalink
Merge pull request #266 from qtzar/bugfix_duplicate_main_branch
Browse files Browse the repository at this point in the history
Restrict list of detected branches to remote only to avoid duplication
  • Loading branch information
dirkgroot authored Jul 7, 2023
2 parents 1a5bc94 + 3c6073d commit d3acd92
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -52,7 +51,7 @@ class ClonedRepository(
}

fun getBranchNames(excludeBranches: List<String>) =
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 }
Expand Down

0 comments on commit d3acd92

Please sign in to comment.