@@ -11,10 +11,8 @@ def setup
1111 end
1212
1313 def test_clone
14- expect_clone ( 'checkstyle' , 'git' , 'https://github.com/checkstyle/checkstyle' ,
15- 'git checkout master; git reset --hard master' )
16- expect_clone ( 'spring-framework' , 'git' , 'https://github.com/spring-projects/spring-framework' ,
17- 'git checkout v5.0.6.RELEASE; git reset --hard v5.0.6.RELEASE' )
14+ expect_git_clone ( 'checkstyle' , 'https://github.com/checkstyle/checkstyle' , 'master' )
15+ expect_git_clone ( 'spring-framework' , 'https://github.com/spring-projects/spring-framework' , 'v5.0.6.RELEASE' )
1816
1917 project_builder = PmdTester ::ProjectBuilder . new ( @projects )
2018 project_builder . clone_projects
@@ -38,11 +36,12 @@ def test_build
3836
3937 private
4038
41- def expect_clone ( name , type , url , reset_cmd )
39+ def expect_git_clone ( name , url , revision )
4240 File . stubs ( :exist? ) . with ( "target/repositories/#{ name } " ) . returns ( false ) . once
43- PmdTester ::Cmd . stubs ( :execute ) . with ( "#{ type } clone #{ url } target/repositories/#{ name } " ) . once
41+ PmdTester ::Cmd . stubs ( :execute ) . with ( "git clone #{ url } target/repositories/#{ name } " \
42+ "--depth 1 --branch #{ revision } --single-branch" ) . once
4443 Dir . stubs ( :chdir ) . with ( "target/repositories/#{ name } " ) . yields . once
45- PmdTester ::Cmd . stubs ( :execute ) . with ( reset_cmd ) . once
44+ PmdTester ::Cmd . stubs ( :execute ) . with ( "git checkout #{ revision } ; git reset --hard #{ revision } " ) . once
4645 end
4746
4847 def expect_build ( name , build_cmd = nil , auxclasspath_cmd = nil )
0 commit comments