mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
Add "--depth" and "-b" arguments for git clone command
- Added --depth 1 option to reduce clone time. - Added -b <branch> option to reduce clone time.
This commit is contained in:
parent
1204cfda9d
commit
f47d09496a
1 changed files with 10 additions and 2 deletions
|
@ -216,10 +216,19 @@ def litex_setup_init_repos(config="standard", tag=None, dev_mode=False):
|
|||
repo_url = repo.url
|
||||
if dev_mode:
|
||||
repo_url = repo_url.replace("https://github.com/", "git@github.com:")
|
||||
|
||||
clone_options = ["--depth 1"]
|
||||
if repo.clone == "recursive":
|
||||
clone_options.append("--recursive")
|
||||
if repo.branch is not None:
|
||||
clone_options.append(f"-b {repo.branch}")
|
||||
options_str = " ".join(clone_options)
|
||||
|
||||
subprocess.check_call("git clone {url} {options}".format(
|
||||
url = repo_url + name + ".git",
|
||||
options = "--recursive" if repo.clone == "recursive" else ""
|
||||
options = options_str
|
||||
), shell=True)
|
||||
|
||||
os.chdir(os.path.join(current_path, name))
|
||||
# Use specific Branch.
|
||||
subprocess.check_call("git checkout " + repo.branch, shell=True)
|
||||
|
@ -490,4 +499,3 @@ def main():
|
|||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
|
Loading…
Reference in a new issue