From c1a9304992812bc36f09d782e0f22edf93093609 Mon Sep 17 00:00:00 2001 From: Clement Dessoude Date: Sun, 12 Nov 2023 16:06:14 +0100 Subject: [PATCH] chore: use specific version for demo-java-x repo parsing --- packages/java-parser/scripts/clone-samples.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/java-parser/scripts/clone-samples.js b/packages/java-parser/scripts/clone-samples.js index db0c1f91f..6ef6d47f3 100644 --- a/packages/java-parser/scripts/clone-samples.js +++ b/packages/java-parser/scripts/clone-samples.js @@ -82,7 +82,8 @@ const sampleRepos = [ }, { repoUrl: "https://github.com/nipafx/demo-java-x", - branch: "main" + branch: "main", + commitHash: "b9facd7bae57512793af4e197446d8064318bf04" } ]; @@ -90,10 +91,21 @@ fs.emptyDirSync(samplesDir); sampleRepos.forEach(cloneRepo); -function cloneRepo({ repoUrl, branch }) { +function cloneRepo({ repoUrl, branch, commitHash }) { console.log(`cloning ${repoUrl}`); - cp.execSync(`git clone ${repoUrl} --branch ${branch} --depth 1`, { - cwd: samplesDir, - stdio: [0, 1, 2] - }); + if (commitHash) { + cp.execSync(`git clone ${repoUrl} --branch ${branch}`, { + cwd: samplesDir, + stdio: [0, 1, 2] + }); + cp.execSync(`git checkout ${commitHash}`, { + cwd: path.resolve(samplesDir, repoUrl.split("/").pop()), + stdio: [0, 1, 2] + }); + } else { + cp.execSync(`git clone ${repoUrl} --branch ${branch} --depth 1`, { + cwd: samplesDir, + stdio: [0, 1, 2] + }); + } }