File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
packages/java-parser/scripts Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -82,18 +82,30 @@ const sampleRepos = [
8282 } ,
8383 {
8484 repoUrl : "https://github.com/nipafx/demo-java-x" ,
85- branch : "main"
85+ branch : "main" ,
86+ commitHash : "b9facd7bae57512793af4e197446d8064318bf04"
8687 }
8788] ;
8889
8990fs . emptyDirSync ( samplesDir ) ;
9091
9192sampleRepos . forEach ( cloneRepo ) ;
9293
93- function cloneRepo ( { repoUrl, branch } ) {
94+ function cloneRepo ( { repoUrl, branch, commitHash } ) {
9495 console . log ( `cloning ${ repoUrl } ` ) ;
95- cp . execSync ( `git clone ${ repoUrl } --branch ${ branch } --depth 1` , {
96- cwd : samplesDir ,
97- stdio : [ 0 , 1 , 2 ]
98- } ) ;
96+ if ( commitHash ) {
97+ cp . execSync ( `git clone ${ repoUrl } --branch ${ branch } ` , {
98+ cwd : samplesDir ,
99+ stdio : [ 0 , 1 , 2 ]
100+ } ) ;
101+ cp . execSync ( `git checkout ${ commitHash } ` , {
102+ cwd : path . resolve ( samplesDir , repoUrl . split ( "/" ) . pop ( ) ) ,
103+ stdio : [ 0 , 1 , 2 ]
104+ } ) ;
105+ } else {
106+ cp . execSync ( `git clone ${ repoUrl } --branch ${ branch } --depth 1` , {
107+ cwd : samplesDir ,
108+ stdio : [ 0 , 1 , 2 ]
109+ } ) ;
110+ }
99111}
You can’t perform that action at this time.
0 commit comments