From cdb3bb967c02183d017e1e8a94ebce608e986d42 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Fri, 7 Apr 2023 18:19:00 -0600 Subject: [PATCH] Update: depth limit for git clone script --- bin/clone_with_ssh.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/clone_with_ssh.py b/bin/clone_with_ssh.py index ae5df71..8ab8f78 100755 --- a/bin/clone_with_ssh.py +++ b/bin/clone_with_ssh.py @@ -13,6 +13,13 @@ parser = argparse.ArgumentParser( description="Git-clone an http link as ssh instead", ) +parser.add_argument( + "--depth", + type=int, + required=False, + help="Max depth to clone", +) + parser.add_argument( "url", type=str, @@ -39,7 +46,10 @@ else: if "git.sr.ht" not in args.url and not ssh_url.endswith(".git"): ssh_url += ".git" -git_cmd = ["git", "clone", ssh_url] +if args.depth is not None: + git_cmd = ["git", "clone", "--depth", str(args.depth), ssh_url] +else: + git_cmd = ["git", "clone", ssh_url] if args.out_name is not None: git_cmd.append(args.out_name)