Skip to content

Commit

Permalink
fix(core): do not clone submodules in renku clone command (#3630)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-alisafaee authored Oct 4, 2023
1 parent cb2736f commit e9986e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions renku/command/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _project_clone(
install_githooks: bool = True,
install_mergetool: bool = True,
skip_smudge: bool = True,
recursive: bool = True,
recursive: bool = False,
depth: Optional[int] = None,
progress: Optional[RemoteProgress] = None,
config: Optional[Dict[str, Any]] = None,
Expand All @@ -49,7 +49,7 @@ def _project_clone(
install_githooks(bool): Whether to install the pre-commit hook or not (Default value = True).
install_mergetool(bool): Whether to install the renku metadata git mergetool or not (Default value = True).
skip_smudge(bool): Whether to skip pulling files from LFS (Default value = True).
recursive(bool): Recursively clone (Default value = True).
recursive(bool): Recursively clone (Default value = False).
depth(Optional[int]): Clone depth (commits from HEAD) (Default value = None).
progress(Optional[RemoteProgress]): Git progress object (Default value = None).
config(Optional[Dict[str, Any]]): Initial config (Default value = None).
Expand Down
17 changes: 10 additions & 7 deletions renku/core/util/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ def clone_renku_repository(
install_githooks=False,
install_lfs=True,
skip_smudge=True,
recursive=True,
recursive=False,
progress=None,
config: Optional[dict] = None,
raise_git_except=False,
Expand All @@ -644,7 +644,7 @@ def clone_renku_repository(
install_githooks: Whether to install git hooks (Default value = False).
install_lfs: Whether to install Git LFS (Default value = True).
skip_smudge: Whether to pull files from Git LFS (Default value = True).
recursive: Whether to clone recursively (Default value = True).
recursive: Whether to clone recursively (Default value = False).
progress: The GitProgress object (Default value = None).
config(Optional[dict], optional): Set configuration for the project (Default value = None).
raise_git_except: Whether to raise git exceptions (Default value = False).
Expand Down Expand Up @@ -710,7 +710,7 @@ def clone_repository(
install_githooks=True,
install_lfs=True,
skip_smudge=True,
recursive=True,
recursive=False,
depth=None,
progress=None,
config: Optional[dict] = None,
Expand All @@ -728,7 +728,7 @@ def clone_repository(
install_githooks: Whether to install git hooks (Default value = True).
install_lfs: Whether to install Git LFS (Default value = True).
skip_smudge: Whether to pull files from Git LFS (Default value = True).
recursive: Whether to clone recursively (Default value = True).
recursive: Whether to clone recursively (Default value = False).
depth: The clone depth, number of commits from HEAD (Default value = None).
progress: The GitProgress object (Default value = None).
config(Optional[dict], optional): Set configuration for the project (Default value = None).
Expand Down Expand Up @@ -760,7 +760,7 @@ def handle_git_exception():

raise errors.GitError(message)

def clean_directory():
def clean_directory(clean: bool):
if not clean or not path:
return
try:
Expand Down Expand Up @@ -791,10 +791,10 @@ def check_and_reuse_existing_repository() -> Optional["Repository"]:
pass
else:
# NOTE: not same remote, so don't reuse
clean_directory()
clean_directory(clean=clean)
return None
except errors.GitError: # NOTE: Not a git repository, remote not found, or checkout failed
clean_directory()
clean_directory(clean=clean)
else:
return repository

Expand Down Expand Up @@ -828,6 +828,9 @@ def clone(branch, depth):
handle_git_exception()
raise

# NOTE: Delete the partially-cloned repository
clean_directory(clean=True)

# NOTE: clone without branch set, in case checkout_revision was not a branch or a tag but a commit
try:
repository = clone(branch=None, depth=None)
Expand Down

0 comments on commit e9986e0

Please sign in to comment.