Skip to content

Commit 0f85498

Browse files
authored
Add an option to enable or disable shallow cloning (#1890)
* Update clone_repository to have an option to clone the entire Git repository history. Signed-off-by: ziad hany <ziadhany2016@gmail.com> * Rename full_history to shallow_clone for clarity Signed-off-by: ziad hany <ziadhany2016@gmail.com> * Update mining minecode_pipelines version Signed-off-by: ziad hany <ziadhany2016@gmail.com> --------- Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 6b854d4 commit 0f85498

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ android_analysis = [
121121
"android_inspector==0.0.1"
122122
]
123123
mining = [
124-
"minecode_pipelines==0.0.1b9"
124+
"minecode_pipelines==0.0.1b11"
125125
]
126126

127127
[project.urls]

scanpipe/pipes/federatedcode.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,19 @@ def check_federatedcode_configured_and_available(logger=None):
145145
logger("Federatedcode repositories are configured and available.")
146146

147147

148-
def clone_repository(repo_url, logger=None):
148+
def clone_repository(repo_url, shallow_clone=True, logger=None):
149149
"""Clone repository to local_path."""
150150
local_dir = tempfile.mkdtemp()
151151

152152
authenticated_repo_url = repo_url.replace(
153153
"https://",
154154
f"https://{settings.FEDERATEDCODE_GIT_SERVICE_TOKEN}@",
155155
)
156-
repo = Repo.clone_from(url=authenticated_repo_url, to_path=local_dir, depth=1)
156+
157+
if shallow_clone:
158+
repo = Repo.clone_from(url=authenticated_repo_url, to_path=local_dir, depth=1)
159+
else:
160+
repo = Repo.clone_from(url=authenticated_repo_url, to_path=local_dir)
157161

158162
repo.config_writer(config_level="repository").set_value(
159163
"user", "name", settings.FEDERATEDCODE_GIT_SERVICE_NAME

0 commit comments

Comments
 (0)