Skip to content

Commit adb45e1

Browse files
committed
feat: add --no-mirror option
1 parent 56f53ee commit adb45e1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ggshield/cmd/secret/scan/repo.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424

2525

2626
@click.command()
27+
@click.option("--no-mirror", is_flag=True, default=False,
28+
help="Don't clone with git --mirror")
2729
@click.argument("repository", nargs=1, type=click.STRING, required=True)
2830
@add_secret_scan_common_options()
2931
@click.pass_context
3032
def repo_cmd(
31-
ctx: click.Context, repository: str, **kwargs: Any
33+
ctx: click.Context, repository: str, no_mirror : bool, **kwargs: Any
3234
) -> int: # pragma: no cover
3335
"""
3436
Scan a REPOSITORY's commits at the given URL or path.
@@ -60,7 +62,10 @@ def repo_cmd(
6062

6163
if REGEX_GIT_URL.match(repository):
6264
with tempfile.TemporaryDirectory() as tmpdirname:
63-
git(["clone", repository, tmpdirname])
65+
git_arguments = ["clone", "--mirror", repository, tmpdirname]
66+
if no_mirror:
67+
git_arguments.remove("--mirror")
68+
git(git_arguments)
6469
scan_context.target_path = Path(tmpdirname)
6570
return scan_repo_path(
6671
client=client,

0 commit comments

Comments
 (0)