commands: fix project clone with --clone-depth

Add a mandatory space between shell arguments. Fix the test cases so
they actually test this as advertised.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Marti Bolivar 2019-10-01 16:47:36 -06:00
parent 6dbe8d53fc
commit 44faeaa3de
3 changed files with 8 additions and 4 deletions

View File

@ -862,7 +862,7 @@ def _fetch(project):
# local ref space.
#
# --tags is required to get tags when the remote is specified as a URL.
fetch_cmd = ('fetch -f --tags' +
fetch_cmd = ('fetch -f --tags ' +
('--depth={clone_depth} ' if project.clone_depth else ' ') +
'-- {url} ')
update_cmd = 'update-ref ' + QUAL_MANIFEST_REV + ' '

View File

@ -14,6 +14,8 @@ from west import configuration as config
import pytest
GIT = shutil.which('git')
# If you change this, keep the docstring in repos_tmpdir() updated also.
MANIFEST_TEMPLATE = '''\
manifest:
defaults:
@ -28,6 +30,7 @@ manifest:
revision: zephyr
path: subdir/Kconfiglib
- name: net-tools
clone-depth: 1
west-commands: scripts/west-commands.yml
self:
path: zephyr
@ -132,13 +135,13 @@ def repos_tmpdir(tmpdir, _session_repos):
remote: test-local
remotes:
- name: test-local
url-base: <tmpdir>/repos
url-base: file://<tmpdir>/repos
projects:
- name: Kconfiglib
revision: zephyr
path: subdir/Kconfiglib
- name: net-tools
clone_depth: 1
clone-depth: 1
west-commands: scripts/west-commands.yml
self:
path: zephyr

View File

@ -51,7 +51,7 @@ def test_list(west_update_tmpdir):
expected = ['manifest HEAD zephyr cloned None',
'Kconfiglib zephyr {} cloned None'.format(
os.path.join('subdir', 'Kconfiglib')),
'net-tools master net-tools cloned None']
'net-tools master net-tools cloned 1']
assert actual.splitlines() == expected
# We should be able to find projects by absolute or relative path
@ -106,6 +106,7 @@ def test_manifest_freeze(west_update_tmpdir):
'^ - name: net-tools$',
'^ remote: test-local$',
'^ revision: [a-f0-9]{40}$',
'^ clone-depth: 1$',
'^ west-commands: scripts/west-commands.yml$',
'^ self:$',
'^ path: zephyr$']