From 07f6a1a685d16a1b7e2c4b05d94670d2543ec29e Mon Sep 17 00:00:00 2001
From: comfyanonymous <comfyanonymous@protonmail.com>
Date: Sat, 27 Jul 2024 03:15:22 -0400
Subject: [PATCH] Handle case in the updater when master branch is not in local
 repo.

---
 .ci/update_windows/update.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/.ci/update_windows/update.py b/.ci/update_windows/update.py
index 127247b2..cc79a914 100755
--- a/.ci/update_windows/update.py
+++ b/.ci/update_windows/update.py
@@ -62,8 +62,15 @@ except:
 
 print("checking out master branch")
 branch = repo.lookup_branch('master')
-ref = repo.lookup_reference(branch.name)
-repo.checkout(ref)
+if branch is None:
+    ref = repo.lookup_reference('refs/remotes/origin/master')
+    repo.checkout(ref)
+    branch = repo.lookup_branch('master')
+    if branch is None:
+        repo.create_branch('master', repo.get(ref.target))
+else:
+    ref = repo.lookup_reference(branch.name)
+    repo.checkout(ref)
 
 print("pulling latest changes")
 pull(repo)
-- 
GitLab