From e41c94615075b7fdf5e44e15c54742077c8728ac Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 4 Nov 2023 13:22:33 +0100
Subject: [PATCH] fix(db-functions): Lock state repo before creating a file

Maybe this doesn't matter because the change isn't staged yet anyway,
but it makes me feel safer.
---
 db-functions-git | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/db-functions-git b/db-functions-git
index 78a6d06..3cb138c 100644
--- a/db-functions-git
+++ b/db-functions-git
@@ -204,6 +204,8 @@ vcs_update_package() {
 	local gittag
 	gittag="$(gittag_from_pkgver "${pkgver}")"
 
+	lock 8 "${GIT_STATE_REPO}/.git/dbscripts.lock" "Locking state repo"
+
 	mkdir -p "${GIT_STATE_REPO}/${dest}"
 	printf '%s %s %s %s\n' \
 		"${pkgbase}" \
@@ -212,8 +214,6 @@ vcs_update_package() {
 		"$(git -C "${GIT_PACKAGES_CACHE}/${pkgbase}" rev-parse "${gittag}")" \
 		> "${GIT_STATE_REPO}/${dest}/${pkgbase}"
 
-	lock 8 "${GIT_STATE_REPO}/.git/dbscripts.lock" "Locking state repo"
-
 	arch_git -C "${GIT_STATE_REPO}" add "${GIT_STATE_REPO}/${dest}/${pkgbase}"
 	vcs_commit "update ${pkgbase} to ${pkgver} in ${dest}"
 
-- 
GitLab