-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Jenkins ver. 2.121.3
Plugin ver. 0.9.5
Hello,
if one git repo is configured in the project SCM configuration and also checked out to a subdirectory for example by a pipeline script, then the branches or tags are duplicated in the selection box.
I modified one of your tests to showcase the problem:
@Test
public void testMultiSCM_forSubdirectoryForRepo() throws IOException, InterruptedException {
project = jenkins.createFreeStyleProject("projectHaveMultiSCM");
project.getBuildersList().add(new Shell("echo test"));
GitSCM gitSCM = (GitSCM) getGitSCM(GIT_CLIENT_REPOSITORY_URL);
gitSCM.getExtensions().add(new RelativeTargetDirectory("subDirectory"));
MultiSCM multiSCM = new MultiSCM(Arrays.asList(getGitSCM(GIT_CLIENT_REPOSITORY_URL), gitSCM));
project.setScm(multiSCM);
GitParameterDefinition def = new GitParameterDefinition("testName",
GitParameterDefinition.PARAMETER_TYPE_BRANCH,
null,
"testDescription",
null,
".*",
"*",
SortMode.ASCENDING, SelectedValue.TOP, null, false);
project.addProperty(new ParametersDefinitionProperty(def));
ListBoxModel items = def.getDescriptor().doFillValueItems(project, def.getName());
assertTrue(isListBoxItem(items, "origin/master"));
int expected = items.size();
def.setUseRepository(".*git-client-plugin.git");
items = def.getDescriptor().doFillValueItems(project, def.getName());
assertTrue(isListBoxItem(items, "origin/master"));
assertEquals(expected, items.size());
}
Thanks for your help.