don't always sync if not needed
This commit is contained in:
parent
26f30023ec
commit
c9098732bf
2 changed files with 23 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Store the commit used for the latest sync
|
||||
.latest
|
21
Makefile
21
Makefile
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue