in logstash/buildSrc/src/main/groovy/ChangeBranchTask.groovy [17:30]
def readyGit(branch, gits) {
gits.each { git ->
println "${git.repository.rootDir}: checking out ${branch}"
git.clean(directories: true)
git.reset(mode: org.ajoberstar.grgit.operation.ResetOp.Mode.HARD)
try {
git.checkout(branch: branch)
} catch (GrgitException e) {
git.branch.add(name: branch, startPoint: "origin/${branch}", mode: org.ajoberstar.grgit.operation.BranchAddOp.Mode.TRACK)
git.checkout(branch: branch)
}
git.pull()
}
}