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

When Wipe out repository & force clone is selected, single branch checkout fails (refspec ignored)

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: git-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      When 

      Wipe out repository & force clone 

      option is selected, Source Code Management -> Git -> Advanced -> Refspec

      +refs/heads/xyz:refs/remotes/origin/xyz

      Is not working

      It simply takes refs/remotes/origin/*

        Attachments

          Activity

          mgharish Harisha MG created issue -
          oleg_nenashev Oleg Nenashev made changes -
          Field Original Value New Value
          Component/s git-plugin [ 15543 ]
          Component/s core [ 15593 ]
          oleg_nenashev Oleg Nenashev made changes -
          Assignee Mark Waite [ markewaite ]
          markewaite Mark Waite made changes -
          Assignee Mark Waite [ markewaite ]
          Hide
          markewaite Mark Waite added a comment - - edited

          Please provide more details about the use case you're describing. Based on your description, I would guess that you:

          1. Create a Freestyle job
          2. Add Git as the SCM for that Freestyle job with a repository (like https://github.com/jenkinsci/git-client-plugin)
          3. Set the "Branches to build" using a non-default branch (like '1.21.x')
          4. Use the "Advanced" button to add a narrower refspec, like:
            +refs/heads/1.21.x:refs/remotes/origin/1.21.x
          5. Add "Wipe out repository & force clone" as an "Additional Behaviours"
          6. Run the job
          7. Review the refspec used in the job, and see that the initial clone did not honor the configured refspec. Instead, the first fetch uses
            git fetch --tags --progress https://github.com/jenkinsci/git-client-plugin +refs/heads/*:refs/remotes/origin/*

          That is the expected behavior. The git plugin initial defaults ignored the refspec on first clone. Many users unknowingly depended on that default behavior of the git plugin.

          Rather than break those users, the git plugin added a configuration option to "Honor refspec on initial clone" to the "Advanced clone options". Refer to JENKINS-28516, JENKINS-31393, JENKINS-33140, JENKINS-35162, JENKINS-36507, and JENKINS-36563.

          If that is not the problem you're describing, please provide more details.

          Show
          markewaite Mark Waite added a comment - - edited Please provide more details about the use case you're describing. Based on your description, I would guess that you: Create a Freestyle job Add Git as the SCM for that Freestyle job with a repository (like https://github.com/jenkinsci/git-client-plugin ) Set the "Branches to build" using a non-default branch (like '1.21.x') Use the "Advanced" button to add a narrower refspec, like: +refs/heads/1.21.x:refs/remotes/origin/1.21.x Add "Wipe out repository & force clone" as an "Additional Behaviours" Run the job Review the refspec used in the job, and see that the initial clone did not honor the configured refspec. Instead, the first fetch uses git fetch --tags --progress https://github.com/jenkinsci/git-client-plugin +refs/heads/*:refs/remotes/origin/* That is the expected behavior. The git plugin initial defaults ignored the refspec on first clone. Many users unknowingly depended on that default behavior of the git plugin. Rather than break those users, the git plugin added a configuration option to "Honor refspec on initial clone" to the "Advanced clone options". Refer to JENKINS-28516 , JENKINS-31393 , JENKINS-33140 , JENKINS-35162 , JENKINS-36507 , and JENKINS-36563 . If that is not the problem you're describing, please provide more details.
          markewaite Mark Waite made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Not A Defect [ 7 ]
          Hide
          mgharish Harisha MG added a comment -

          Yes, the steps which we followed is the same and the solution provided is working.

           

          Thank you for quick resolution

          Show
          mgharish Harisha MG added a comment - Yes, the steps which we followed is the same and the solution provided is working.   Thank you for quick resolution
          mgharish Harisha MG made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          markewaite Mark Waite made changes -
          Summary When Wipe out repository & force clone is selected, single branch checkout does not happen When Wipe out repository & force clone is selected, single branch checkout fails (refspec ignored)

            People

            • Assignee:
              Unassigned
              Reporter:
              mgharish Harisha MG
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: