-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Any version from
Reproduce steps:
- Create branch
- Execute pipeline with LocalBranch
- Add commits to branch
- Repeat pipeline in same workspace - no new commits will be used from original
Criteria to reproduce:
- Usage of LocalBranch extension
- Usage of original branch name containig '/' symbol
Problem in class:
hudson.plugins.git.util.DefaultBuildChooser#getCandidateRevisions
Example Pipeline:
node('master') { stage('Checkout'){ script { String url = 'https://example.com/repository.git' //: Branch name containing `/` symbol String branch = 'feature/branch' String credentialsId = 'secret-credentials' //: Checkout original checkout scm: [ $class: 'GitSCM', userRemoteConfigs: [ [ url: url, credentialsId: credentialsId ] ], extensions: [[$class: 'LocalBranch']], branches: [ [name: branch] ] ] //: Change local history sh('git reset --hard HEAD^') //: Checkout one more time - local history will be used checkout scm: [ $class: 'GitSCM', userRemoteConfigs: [ [ url: url, credentialsId: credentialsId ] ], extensions: [[$class: 'LocalBranch']], branches: [ [name: branch] ] ] } } }
Workaround:
Execute before checkout
sh('rm -rf .git/refs/heads/*')
To remove local branches refs