Hi Mark
Right now what I'm trying to do is something like this and change groovy library
- def git_opts = history ? '--filter=tree:0' : '--depth 1'
+ def depth = history ? 0 : 1
def updateRepository = {
- if (context.fileExists(directory)) {
- context.dir(directory) {
- context.sh """
- git remote remove origin
- git remote add origin ${url}
- git remote set-branches --add origin ${branch}
- git fetch origin ${branch} ${git_opts}
- git reset --hard FETCH_HEAD
- """
- }
- } else {
- context.sh "git clone ${git_opts} --branch ${branch}
${url} ${directory}"
- }
+ context.checkout(
+ changelog: true,
+ poll: false,
+ scm: [
+ $class: 'GitSCM',
+ branches: [[name: "*/${branch}"]],
+ extensions: [
+ [$class: 'cleanAfterCheckout',
deleteUntrackedNestedRepositories: true],
+ [$class: 'RelativeTargetDirectory',
relativeTargetDir: "${directory}"],
+ [$class: 'CloneOption', depth: "${depth}",
honorRefspec: true, noTags: false, \
+ reference: "${directory}", shallow:
depth > 0 ? true : false
+ ]
+ ],
+ userRemoteConfigs: [
+ [credentialsId: "${credentials}", url: "${url}"]
+ ]
+ ]
+ )
}
This is not exactly the same (by the way needs to be tested) but using
gitscm I have a lot more features. Would be nice to allow
gitscm to re-evaluate some already checkout or already .git on
filesystem to calculate the data. Looking at several plugins does not
sound very easy. The reason that I'm moving to using gitscm is to
integrate plugins like git-forensic etc. I have found gitSCM really
nice
but could be a bit limited if you are trying to have more git
flexibility. Like in this case I can not use --filter=tree:0'
Michael
> Mark Waite
>
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
jenkinsci-de...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/jenkinsci-dev/ea47d6bd-097f-41b2-a223-ae42d1277853n%40googlegroups.com.
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M.
+39 347 913 2170
mic...@amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T.
+31 (0)85 111 9172
in...@amarulasolutions.com
www.amarulasolutions.com