diff --git a/checkstyle-tester/diff.groovy b/checkstyle-tester/diff.groovy index da4fcd26..a0dba27c 100644 --- a/checkstyle-tester/diff.groovy +++ b/checkstyle-tester/diff.groovy @@ -343,11 +343,11 @@ def getCommitSha(commitId, repoType, srcDestinationDir) { return sha.replace('\n', '') } -def getCloneCmd(repoType, repoUrl, srcDestinationDir) { +def getCloneCmd(repoType, repoUrl, srcDestinationDir, commitId) { def cloneCmd = '' switch (repoType) { case 'git': - cloneCmd = "git clone $repoUrl $srcDestinationDir" + cloneCmd = "git clone --depth 1 --branch $commitId $repoUrl $srcDestinationDir" break case 'hg': cloneCmd = "hg clone $repoUrl $srcDestinationDir" @@ -361,7 +361,7 @@ def getCloneCmd(repoType, repoUrl, srcDestinationDir) { def cloneRepository(repoName, repoType, repoUrl, commitId, srcDir) { def srcDestinationDir = getOsSpecificPath("$srcDir", "$repoName") if (!Files.exists(Paths.get(srcDestinationDir))) { - def cloneCmd = getCloneCmd(repoType, repoUrl, srcDestinationDir) + def cloneCmd = getCloneCmd(repoType, repoUrl, srcDestinationDir, commitId) println "Cloning $repoType repository '$repoName' to $srcDestinationDir folder ..." executeCmdWithRetry(cloneCmd) println "Cloning $repoType repository '$repoName' - completed\n"