Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53911

Duplicate entries in list, if git repo is checked out twice.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: git-parameter-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.121.3
      Plugin ver. 0.9.5
    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          aschepp Alexander Schepp created issue -
          klimas7 Boguslaw Klimas made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          klimas7 Boguslaw Klimas made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]

            People

            Assignee:
            klimas7 Boguslaw Klimas
            Reporter:
            aschepp Alexander Schepp
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: