Git source: Make a shallow clone. #248

Merged
merged 1 commit into from Jan 21, 2016
Jump to file or symbol
Failed to load files and symbols.
+6 −6
Split
View
@@ -127,7 +127,7 @@ def pull(self):
if self.source_tag or self.source_branch:
branch_opts = ['--branch',
self.source_tag or self.source_branch]
- cmd = ['git', 'clone'] + branch_opts + \
+ cmd = ['git', 'clone', '--depth', '1'] + branch_opts + \
[self.source, self.source_dir]
subprocess.check_call(cmd)
@@ -136,25 +136,25 @@ def test_pull(self):
git.pull()
self.mock_run.assert_called_once_with(
- ['git', 'clone', 'git://my-source', 'source_dir'])
+ ['git', 'clone', '--depth', '1', 'git://my-source', 'source_dir'])
def test_pull_branch(self):
git = snapcraft.sources.Git('git://my-source', 'source_dir',
source_branch='my-branch')
git.pull()
self.mock_run.assert_called_once_with(
- ['git', 'clone', '--branch', 'my-branch', 'git://my-source',
- 'source_dir'])
+ ['git', 'clone', '--depth', '1', '--branch', 'my-branch',
+ 'git://my-source', 'source_dir'])
def test_pull_tag(self):
git = snapcraft.sources.Git('git://my-source', 'source_dir',
source_tag='tag')
git.pull()
self.mock_run.assert_called_once_with(
- ['git', 'clone', '--branch', 'tag', 'git://my-source',
- 'source_dir'])
+ ['git', 'clone', '--depth', '1', '--branch', 'tag',
+ 'git://my-source', 'source_dir'])
def test_pull_existing(self):
self.mock_path_exists.return_value = True