Skip to content

Commit 5221212

Browse files
committed
Use --no-single-branch when git cloning
1 parent 2d7f63f commit 5221212

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/pmdtester/builders/project_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def clone_projects
2828
# Don't download whole history
2929
# Note we don't use --single-branch, because the repo is downloaded
3030
# once but may be used with several tags.
31-
clone_cmd = "git clone #{project.connection} #{path} --depth 1"
31+
clone_cmd = "git clone --no-single-branch --depth 1 #{project.connection} #{path}"
3232

3333
Cmd.execute(clone_cmd)
3434
end

test/test_project_builder.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def test_build
3838

3939
def expect_git_clone(name, url, revision)
4040
File.stubs(:exist?).with("target/repositories/#{name}").returns(false).once
41-
PmdTester::Cmd.stubs(:execute).with("git clone #{url} target/repositories/#{name} --depth 1").once
41+
PmdTester::Cmd.stubs(:execute).with('git clone --no-single-branch --depth 1' \
42+
" #{url} target/repositories/#{name}").once
4243
Dir.stubs(:chdir).with("target/repositories/#{name}").yields.once
4344
PmdTester::Cmd.stubs(:execute).with("git checkout #{revision}; git reset --hard #{revision}").once
4445
end

0 commit comments

Comments
 (0)