# `2>/dev/null` suppress errors and `|| true` suppress the error codes.
TAG := $(shell git describe --abbrev=0 --tags ${COMM_TAG} 2>/dev/null || true)
# here we strip the version prefix
-TAG_VERS := $(TAG:v%=%)
+TAG_VERS :=$(TAG:v%=%)
# get the latest commit hash in the short form
COMM_HASH := $(shell git rev-parse --short=8 HEAD 2>/dev/null) # Get short commit hash
#COMMIT := $(shell git rev-parse --short HEAD)
# get the latest commit date in the form of YYYYmmdd
COMM_DATE := $(shell git log -1 --format=%cd --date=format:"%Y%m%d%H%M")
ifneq ($(COMM_HASH), $(COMM_TAG))
- TAG_VERS := $(TAG_VERS)-next-$(COMM_HASH)-$(COMM_DATE)
+ TAG_VERS :=$(TAG_VERS)-next-$(COMM_HASH)-$(COMM_DATE)
endif
ifeq ($(TAG_VERS), )
- TAG_VERS := $(COMM_HASH)-$(COMM_DATE)
+ TAG_VERS :=$(COMM_HASH)-$(COMM_DATE)
endif
ifneq ($(shell git status --porcelain), )
- TAG_VERS := $(TAG_VERS)-dirty
+ TAG_VERS :=$(TAG_VERS)-dirty
endif
COMMIT_ID := $(VERSION)
bin/checksums.sh > html/tmp/$@
commit: check-uncommitted
+ @echo "Warning: Uncommitted changes detected! Go to autocommit steps..."
+ git branch -v
+ git commit -am "$(COMM_INFO)"
+ git push
#@if [ -n "$$(git diff --quiet)" ] && [ -n "$$(git diff --cached --quiet)" ] && [ -n "$$(git ls-files --others --exclude-standard)" ]; then \
#[ -n "$$(git status --porcelain)" ]
check-uncommitted:
- @if [ -n "$$(git diff --quiet)" ] && [ -n "$$(git diff --cached --quiet)" ] && [ -n "$$(git ls-files --others --exclude-standard)" ]; then \
- echo "Warning: Uncommitted changes detected! Go to autocommit steps..."; \
- else \
- echo "Repository is clean (no uncommitted or untracked changes). Go to additional checks..."; \
- cd $(BUILD_DIR) && \
- git
+ @if [ -n "$$(git diff --quiet)" ] && [ -n "$$(git diff --cached --quiet)" ] && [ -n "$$(git ls-files --others --exclude-standard)" ]; then :; else \
+ echo "The first checks have been passed, the repo seems to be clean... But... Still, let's check a little more! :)"; \
+ @if [ -n "$$(git status --porcelain)" ]; then \
+ echo "Repository is clean (no uncommitted or untracked changes). Exit 0."; \
+ exit 0; \
+ else \
+ echo "Error! Git status is not porcelain! Check it mannualy. Exit 1."; \
+ exit 1; \
fi
exit 0; \
fi
-#check-uncommitted:
-# @echo "Warning: Uncommitted changes detected! Go to autocmmit...";
-# git add .
-# git commit -m $(COMMITINFO)
-# $@
-
-#.PHONY: check-uncommitted
-#check-uncommitted:
-fake_target:
- @if git diff --quiet && git diff --cached --quiet && [ -z "$$(git ls-files --others --exclude-standard)" ]; then \
- echo "Repository is clean (no uncommitted or untracked changes). Exit."; \
- exit 0; \
- else \
- git add . && \
- fi
-
-# git add . && \
-# commitinfo && \
-# git push origin $(BRANCH)
-# git commit -m "$(@:git-%=%)"
-
commitinfo: $(commitinfo.sh)
.PHONY: $(commitinfo.sh)