From b55b07f0f29c50867d2a8a3cf26fa9267dda7687 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Tue, 12 Jul 2022 15:44:04 -0400
Subject: [PATCH] let the branch exist already

---
 ci-tools/update-nixpkgs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ci-tools/update-nixpkgs b/ci-tools/update-nixpkgs
index 07b00a41..e8ce8fbd 100755
--- a/ci-tools/update-nixpkgs
+++ b/ci-tools/update-nixpkgs
@@ -4,10 +4,12 @@
 set -eux -o pipefail
 
 TARGET_BRANCH="nixpkgs-upgrade-$(date +%Y-%m-%d)"
-git checkout -b "${TARGET_BRANCH}"
 
 echo '{}' > morph/grid/local/public-keys/users.nix
 nix-build -A morph -o result-before
+
+git checkout "${TARGET_BRANCH}" || git checkout -b "${TARGET_BRANCH}"
+
 update-nixpkgs
 nix-build -A morph -o result-after
 diff=$(nix --extra-experimental-features nix-command store diff-closures ./result-before/ ./result-after/)
-- 
GitLab