From a5274f123c328b9b0a7f2ddf6a0adbb1b235cdde Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 26 Mar 2021 20:21:37 +0100 Subject: [PATCH] Fix non-master branch switching for repos --- app-json.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app-json.py b/app-json.py index 675e0b8..ee68714 100755 --- a/app-json.py +++ b/app-json.py @@ -19,10 +19,11 @@ def clone_apps(): repos = [[p["name"], p["ssh_url"]] for p in response.json()] for name, url in repos: try: - run(split(f"git clone {url} {clones}/{name}")) - chdir(f"{clones}/{name}") - if not check_output("git branch --list | wc -l", shell=True): - run(split("git checkout main")) + if not exists(f"{clones}/{name}"): + run(split(f"git clone {url} {clones}/{name}")) + chdir(f"{clones}/{name}") + if not int(check_output("git branch --list | wc -l", shell=True)): + run(split("git checkout main")) except Exception: pass