Skip to content

Commit 6c53640

Browse files
committed
MDBF-143: prep - GitInitFromCommand - depth configurable
Non-impacting change; now depth is optional, and depth 0 means there is no depth limit.
1 parent f997520 commit 6c53640

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

configuration/steps/commands/download.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,29 @@ def __init__(
4646
repo_url: str,
4747
workdir: PurePath = PurePath("."),
4848
jobs: int = 1,
49+
depth: int = 1,
4950
):
5051
super().__init__(name="Git", workdir=workdir)
5152
self.commit = commit
5253
self.repo_url = repo_url
5354
self.jobs = jobs
55+
self.depth = depth
5456

5557
def as_cmd_arg(self) -> list[str]:
58+
if self.depth != 0:
59+
depth = "--depth " + str(self.depth)
60+
else:
61+
depth = ""
5662
return [
5763
"bash",
5864
"-exc",
5965
util.Interpolate(
6066
(
6167
"git init && "
6268
f"git remote add origin {self.repo_url} && "
63-
f"git fetch --depth 1 origin {self.commit} && "
69+
f"git fetch {depth} origin {self.commit} && "
6470
"git checkout FETCH_HEAD && "
65-
f"git submodule update --init --recursive --depth 1 --jobs={self.jobs}"
71+
f"git submodule update --init --recursive {depth} --jobs={self.jobs}"
6672
)
6773
),
6874
]

0 commit comments

Comments
 (0)