don't always sync if not needed

This commit is contained in:
Mylloon 2025-04-22 09:57:16 +02:00
parent 26f30023ec
commit c9098732bf
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 23 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# Store the commit used for the latest sync
.latest

View file

@ -34,6 +34,17 @@ TERMUX = $(firstword $(shell type termux-info &> /dev/null && echo 1))
ADMIN_WIN = $(shell touch $(PF) 2> /dev/null; echo $$?)
# Check for latest version
LATEST_FILE = .latest
HAS_CHANGES = $(shell git status -s)
CURRENT_COMMIT = $(shell git rev-parse HEAD)
LATEST_COMMIT = $(shell cat $(LATEST_FILE))
# Special targets
.ONESHELL:
all: full-sync
@ -283,6 +294,15 @@ ifneq (1, $(filter 1, $(ARCH) $(WSL) $(TERMUX)))
@echo "❌ Unsupported platform"
else
# Check if repo is updated locally or has been updated from remote
ifeq ($(strip $(HAS_CHANGES)),)
ifeq ($(CURRENT_COMMIT),$(LATEST_COMMIT))
@echo "✅ Nothing to update!"
@exit
endif
endif
# Call target of compatible with all supported platforms
@$(MAKE) sync-dotconfig
@echo "⌛ .config directory synced!"
@ -326,5 +346,6 @@ else ifeq ($(TERMUX), 1)
endif
# END
@echo $(CURRENT_COMMIT) > $(LATEST_FILE)
@echo "🎉 Sync complete!"
endif