Fix non-master branch switching for repos

This commit is contained in:
decentral1se 2021-03-26 20:21:37 +01:00
parent fc12634fbb
commit a5274f123c
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A

View File

@ -19,10 +19,11 @@ def clone_apps():
repos = [[p["name"], p["ssh_url"]] for p in response.json()] repos = [[p["name"], p["ssh_url"]] for p in response.json()]
for name, url in repos: for name, url in repos:
try: try:
run(split(f"git clone {url} {clones}/{name}")) if not exists(f"{clones}/{name}"):
chdir(f"{clones}/{name}") run(split(f"git clone {url} {clones}/{name}"))
if not check_output("git branch --list | wc -l", shell=True): chdir(f"{clones}/{name}")
run(split("git checkout main")) if not int(check_output("git branch --list | wc -l", shell=True)):
run(split("git checkout main"))
except Exception: except Exception:
pass pass