Skip to content

Commit e9986e0

Browse files
fix(core): do not clone submodules in renku clone command (#3630)
1 parent cb2736f commit e9986e0

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

renku/command/clone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _project_clone(
3333
install_githooks: bool = True,
3434
install_mergetool: bool = True,
3535
skip_smudge: bool = True,
36-
recursive: bool = True,
36+
recursive: bool = False,
3737
depth: Optional[int] = None,
3838
progress: Optional[RemoteProgress] = None,
3939
config: Optional[Dict[str, Any]] = None,
@@ -49,7 +49,7 @@ def _project_clone(
4949
install_githooks(bool): Whether to install the pre-commit hook or not (Default value = True).
5050
install_mergetool(bool): Whether to install the renku metadata git mergetool or not (Default value = True).
5151
skip_smudge(bool): Whether to skip pulling files from LFS (Default value = True).
52-
recursive(bool): Recursively clone (Default value = True).
52+
recursive(bool): Recursively clone (Default value = False).
5353
depth(Optional[int]): Clone depth (commits from HEAD) (Default value = None).
5454
progress(Optional[RemoteProgress]): Git progress object (Default value = None).
5555
config(Optional[Dict[str, Any]]): Initial config (Default value = None).

renku/core/util/git.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ def clone_renku_repository(
625625
install_githooks=False,
626626
install_lfs=True,
627627
skip_smudge=True,
628-
recursive=True,
628+
recursive=False,
629629
progress=None,
630630
config: Optional[dict] = None,
631631
raise_git_except=False,
@@ -644,7 +644,7 @@ def clone_renku_repository(
644644
install_githooks: Whether to install git hooks (Default value = False).
645645
install_lfs: Whether to install Git LFS (Default value = True).
646646
skip_smudge: Whether to pull files from Git LFS (Default value = True).
647-
recursive: Whether to clone recursively (Default value = True).
647+
recursive: Whether to clone recursively (Default value = False).
648648
progress: The GitProgress object (Default value = None).
649649
config(Optional[dict], optional): Set configuration for the project (Default value = None).
650650
raise_git_except: Whether to raise git exceptions (Default value = False).
@@ -710,7 +710,7 @@ def clone_repository(
710710
install_githooks=True,
711711
install_lfs=True,
712712
skip_smudge=True,
713-
recursive=True,
713+
recursive=False,
714714
depth=None,
715715
progress=None,
716716
config: Optional[dict] = None,
@@ -728,7 +728,7 @@ def clone_repository(
728728
install_githooks: Whether to install git hooks (Default value = True).
729729
install_lfs: Whether to install Git LFS (Default value = True).
730730
skip_smudge: Whether to pull files from Git LFS (Default value = True).
731-
recursive: Whether to clone recursively (Default value = True).
731+
recursive: Whether to clone recursively (Default value = False).
732732
depth: The clone depth, number of commits from HEAD (Default value = None).
733733
progress: The GitProgress object (Default value = None).
734734
config(Optional[dict], optional): Set configuration for the project (Default value = None).
@@ -760,7 +760,7 @@ def handle_git_exception():
760760

761761
raise errors.GitError(message)
762762

763-
def clean_directory():
763+
def clean_directory(clean: bool):
764764
if not clean or not path:
765765
return
766766
try:
@@ -791,10 +791,10 @@ def check_and_reuse_existing_repository() -> Optional["Repository"]:
791791
pass
792792
else:
793793
# NOTE: not same remote, so don't reuse
794-
clean_directory()
794+
clean_directory(clean=clean)
795795
return None
796796
except errors.GitError: # NOTE: Not a git repository, remote not found, or checkout failed
797-
clean_directory()
797+
clean_directory(clean=clean)
798798
else:
799799
return repository
800800

@@ -828,6 +828,9 @@ def clone(branch, depth):
828828
handle_git_exception()
829829
raise
830830

831+
# NOTE: Delete the partially-cloned repository
832+
clean_directory(clean=True)
833+
831834
# NOTE: clone without branch set, in case checkout_revision was not a branch or a tag but a commit
832835
try:
833836
repository = clone(branch=None, depth=None)

0 commit comments

Comments
 (0)