Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion renku/core/management/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from renku.core import errors
from renku.core.management.githooks import install
from renku.core.models.git import GitURL


def clone(
Expand All @@ -38,7 +39,7 @@ def clone(
"""Clone Renku project repo, install Git hooks and LFS."""
from renku.core.management.client import LocalClient

path = path or '.'
path = path or GitURL.parse(url).name
# Clone the project
if skip_smudge:
os.environ['GIT_LFS_SKIP_SMUDGE'] = '1'
Expand Down
17 changes: 17 additions & 0 deletions tests/cli/test_integration_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,3 +927,20 @@ def test_renku_clone(runner, monkeypatch):
result = runner.invoke(cli, ['run', 'touch', 'output'])
assert 'is not configured' in result.output
assert 1 == result.exit_code


@pytest.mark.integration
@pytest.mark.parametrize(
'path,expected_path', [('', 'datasets-test'), ('.', '.'),
('new-name', 'new-name')]
)
def test_renku_clone_uses_project_name(
runner, monkeypatch, path, expected_path
):
"""Test renku clone uses project name as target-path by default."""
REMOTE = 'https://dev.renku.ch/gitlab/virginiafriedrich/datasets-test.git'

with runner.isolated_filesystem() as project_path:
result = runner.invoke(cli, ['clone', REMOTE, path])
assert 0 == result.exit_code
assert (Path(project_path) / expected_path / 'Dockerfile').exists()