I set the refscpec such that Jenkins would not include the repo name in the branch name. Jenkins still appended the repo name to the branch name. I need the branch names in Jenkins to match that of the origin so that gitVersion functions correctly. See the attached image for details

          [JENKINS-35162] git plugin does not respect refspec

          Mark Waite added a comment -

          Could explain in more detail (or with examples) what you mean when you say that "Jenkins would not include the repo name in the branch name"?

          Is your goal to checkout a local branch named like the remote branch, as in "master" is checked out if the remote branch is "origin/master"? If so, then you can get that with git plugin 2.4.4 and later using the "Checkout to local branch" additional behaviour. Use the value "**", or leave the field blank. The plugin will then infer the branch name from the remote branch name.

          Mark Waite added a comment - Could explain in more detail (or with examples) what you mean when you say that "Jenkins would not include the repo name in the branch name"? Is your goal to checkout a local branch named like the remote branch, as in "master" is checked out if the remote branch is "origin/master"? If so, then you can get that with git plugin 2.4.4 and later using the "Checkout to local branch" additional behaviour. Use the value "**", or leave the field blank. The plugin will then infer the branch name from the remote branch name.

          Mark Waite added a comment -

          mdkf, the git plugin prior to 2.5.1 ignored the refspec on initial clone (as described in JENKINS-31393).

          Git plugin 2.5.1 and 2.5.2 honor the refspec on initial clone. Unfortunately, that broke several use cases (as described in JENKINS-36507 and JENKINS-36563 and JENKINS-21845)

          Git plugin 2.5.3 (released 30 July 2016) returns to the default behavior of git plugin prior to 2.5.1 by ignoring the refspec on initial clone, but extends "Advanced clone behaviours" with the option "Honor refspec on initial clone". I would have preferred to make the default behavior honor the refspec on initial clone, but there did not seem to be any way to retain at least one of the existing use cases and still default to honor refspec on initial clone. Could you check this with git plugin 2.5.3?

          Mark Waite added a comment - mdkf , the git plugin prior to 2.5.1 ignored the refspec on initial clone (as described in JENKINS-31393 ). Git plugin 2.5.1 and 2.5.2 honor the refspec on initial clone. Unfortunately, that broke several use cases (as described in JENKINS-36507 and JENKINS-36563 and JENKINS-21845 ) Git plugin 2.5.3 (released 30 July 2016) returns to the default behavior of git plugin prior to 2.5.1 by ignoring the refspec on initial clone, but extends "Advanced clone behaviours" with the option "Honor refspec on initial clone". I would have preferred to make the default behavior honor the refspec on initial clone, but there did not seem to be any way to retain at least one of the existing use cases and still default to honor refspec on initial clone. Could you check this with git plugin 2.5.3?

            Unassigned Unassigned
            mdkf Michael Fowler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: