Skip to content

Commit d334cae

Browse files
feat: use project name as default path when cloning (#857)
1 parent a3116fa commit d334cae

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

renku/core/management/clone.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from renku.core import errors
2525
from renku.core.management.githooks import install
26+
from renku.core.models.git import GitURL
2627

2728

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

41-
path = path or '.'
42+
path = path or GitURL.parse(url).name
4243
# Clone the project
4344
if skip_smudge:
4445
os.environ['GIT_LFS_SKIP_SMUDGE'] = '1'

tests/cli/test_integration_datasets.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,3 +927,20 @@ def test_renku_clone(runner, monkeypatch):
927927
result = runner.invoke(cli, ['run', 'touch', 'output'])
928928
assert 'is not configured' in result.output
929929
assert 1 == result.exit_code
930+
931+
932+
@pytest.mark.integration
933+
@pytest.mark.parametrize(
934+
'path,expected_path', [('', 'datasets-test'), ('.', '.'),
935+
('new-name', 'new-name')]
936+
)
937+
def test_renku_clone_uses_project_name(
938+
runner, monkeypatch, path, expected_path
939+
):
940+
"""Test renku clone uses project name as target-path by default."""
941+
REMOTE = 'https://dev.renku.ch/gitlab/virginiafriedrich/datasets-test.git'
942+
943+
with runner.isolated_filesystem() as project_path:
944+
result = runner.invoke(cli, ['clone', REMOTE, path])
945+
assert 0 == result.exit_code
946+
assert (Path(project_path) / expected_path / 'Dockerfile').exists()

0 commit comments

Comments
 (0)