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:
- 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
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.
Please provide more details about the use case you're describing. Based on your description, I would guess that you:
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, andJENKINS-36563.If that is not the problem you're describing, please provide more details.