Skip to content

Commit

Permalink
Issue #818: do shallow clone to speedup download
Browse files Browse the repository at this point in the history
  • Loading branch information
romani committed Dec 3, 2023
1 parent 71ad00e commit c7cef4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions checkstyle-tester/diff.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit c7cef4d

Please sign in to comment.