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.

    Details

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

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            markewaite Mark Waite added a comment -

            I think your proposed solution will break several use cases among the 50000+ installations of the git plugin. It seems like too fundamental a change to accept it into the code base.

            Would you be willing to evaluate the current changes which are on the master branch?

            The git plugin and git client plugin are being tested in hopes of releasing new versions before the end of June. If you're willing to assist with the testing, please download and install a pre-release build of the git client plugin and the git plugin. Problems detected in the pre-release should be e-mailed to Mark Waite and Nicolas De Loof.

            I wrote some test ideas if you would like suggestions of areas that need testing. The git plugin supports many different use cases and its automated tests only evaluate a very few of those use cases.

            Show
            markewaite Mark Waite added a comment - I think your proposed solution will break several use cases among the 50000+ installations of the git plugin. It seems like too fundamental a change to accept it into the code base. Would you be willing to evaluate the current changes which are on the master branch? The git plugin and git client plugin are being tested in hopes of releasing new versions before the end of June. If you're willing to assist with the testing, please download and install a pre-release build of the git client plugin and the git plugin . Problems detected in the pre-release should be e-mailed to Mark Waite and Nicolas De Loof . I wrote some test ideas if you would like suggestions of areas that need testing. The git plugin supports many different use cases and its automated tests only evaluate a very few of those use cases.
            Hide
            markewaite Mark Waite added a comment -

            This won't be changed as proposed because it will break too many existing users.

            Show
            markewaite Mark Waite added a comment - This won't be changed as proposed because it will break too many existing users.

              People

              • Assignee:
                ndeloof Nicolas De Loof
                Reporter:
                gustave Gustave Laville
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: