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

The Jenkins git-plugin (v 2.3.5) does not handle branch names containing a slash correctly.



    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Component/s: git-plugin
    • Labels:
    • Environment:
      Version 2.3.5 of git-plugin
    • Similar Issues:


      When a BranchSpec is created by AbstractGitSCMSource it's name doesn't contain the "origin/" prefix. If the branch name doesn't contain a slash ("/"), the branch name is considered "unqualified" and for matching purposes a regular expressing with a "*/" prefix is used.
      If the unqualified branch name contains a slash, it is treated as qualified name and no wildcard is prepended. This has the effect that a branch doesn't match itself (e.g. when polling a repository for changes, see line 591 of GitSCM).

      Given that an unqualified branch name may contain slashes, it is not possible to recognize unqualified branch names from the absence of a slash (see line 124 of BranchSpec).

      A proposed (partial) solution can be found at https://github.com/gv2011/git-plugin/tree/branch-name.

      Here the qualified branch name is used when AbstractGitSCMSource creates a BranchSpec.

      For the String constructor, the problem can possibly be avoided by always using the qualified branch name (prefix "origin/"). Anyway, this is a very confusing situation because SCMHead uses the unqualified name. Additionally, when you talk about a branch in a remote repository, you normally don't care about the local name of the remote repository.

      I suppose that only in very special use cases a name different from "origin" will be needed.


          Issue Links


            gustave Gustave Laville created issue -
            gustave Gustave Laville made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-27332 [ JENKINS-27332 ]
            markewaite Mark Waite made changes -
            Resolution Won't Fix [ 2 ]
            Status Open [ 1 ] Closed [ 6 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 163775 ] JNJira + In-Review [ 208880 ]


              ndeloof Nicolas De Loof
              gustave Gustave Laville
              0 Vote for this issue
              2 Start watching this issue