blog.grace.moe

Source for the blog blog.grace.moe
git clone https://git.grace.moe/blog.grace.moe
Log | Files | Refs

commit c459dd4d07fe22f1820a63a06250c6ee8389bc96
parent 90bfe9aeee01ac94b51c60b0adb2563d9952dbef
Author: gracefu <81774659+gracefuu@users.noreply.github.com>
Date:   Thu, 10 Apr 2025 15:58:35 +0800

Fix git gc racing with upload

Diffstat:
MMakefile | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -78,7 +78,9 @@ STORAGECMD=curl -H 'AccessKey: $(STORAGEPASSWORD)' -s PURGEURL='https://api.bunny.net/pullzone/$(PULLZONEID)/purgeCache' APICMD=curl -H 'AccessKey: $(APIPASSWORD)' -s -all: upload clean +all: + $(MAKE) rebuild + $(MAKE) upload clean rm -rf $(TMPPATH) if [ -n '$(PULLZONEID)' ]; then $(APICMD) -XPOST '$(PURGEURL)' && echo 'Purged.' @@ -91,14 +93,14 @@ rebuild: zine release [ -d public/.git ] || git init --bare public/.git git push --mirror --force public/.git - git -C public/.git gc + git -C public/.git gc --no-detach --aggressive git -C public/.git update-server-info upload: $(addprefix $(TMPPATH)/upload/,$(UPLOAD)) clean: $(addprefix $(TMPPATH)/clean/,$(CLEAN)) nothing: -$(TMPPATH)/contents/%/contents: rebuild +$(TMPPATH)/contents/%/contents: # Get dir contents from bunny, and # Delete any files or directories on bunny that don't exist locally mkdir -p '$(@D)' @@ -108,9 +110,9 @@ $(TMPPATH)/contents/%/contents: rebuild $(TMPPATH)/clean/%: $(TMPPATH)/contents/$$(call hash,$$*)/$$*/contents # echo + clean '$(*)' - $(MAKE) NOREBUILD=1 nothing $$(<'$<' jq -r '"$(TMPPATH)/cleanfile/$(*)/" + + $(MAKE) nothing $$(<'$<' jq -r '"$(TMPPATH)/cleanfile/$(*)/" + (arrays | .[] | select(.IsDirectory == false).ObjectName)') - $(MAKE) NOREBUILD=1 nothing $$(<'$<' jq -r '"$(TMPPATH)/cleandir/$(*)/" + + $(MAKE) nothing $$(<'$<' jq -r '"$(TMPPATH)/cleandir/$(*)/" + (arrays | .[] | select(.IsDirectory == true).ObjectName)') echo - clean '$(*)'