Skip to content

Commit 8d775b6

Browse files
committed
Update clone_repository to have an option to clone the entire Git repository history.
Signed-off-by: ziad hany <[email protected]>
1 parent 6b854d4 commit 8d775b6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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, full_history=False, 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 full_history:
158+
repo = Repo.clone_from(url=authenticated_repo_url, to_path=local_dir)
159+
else:
160+
repo = Repo.clone_from(url=authenticated_repo_url, to_path=local_dir, depth=1)
157161

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

0 commit comments

Comments
 (0)