<commit_before>SF_PROMOTE_ENVS := \
	dev \
	prod-staging \
	prod \

# ------------------------------------------------------------------------------

.PHONY: promote/%
promote/%: ## promote/<env>/<tag> Promote tag to env branch.
	$(eval ENV_NAME := $(shell dirname "$*"))
	$(eval TAG := $(shell basename "$*"))
	$(ECHO) "$(SF_PROMOTE_ENVS)" | $(GREP) -q -e "\(^\|\s\)$(ENV_NAME)\(\s\|$$\)" || { \
		$(ECHO_ERR) "$(ENV_NAME) is not a known env."; \
		exit 1; \
	}
	$(GIT) tag --list | $(GREP) -q "^$(TAG)$$" || { \
		$(ECHO_ERR) "$(TAG) is not a tag."; \
		exit 1; \
	}
	$(GIT) push -f $(GIT_REMOTE) \
		$$($(GIT) rev-list -n1 $(TAG)):refs/heads/env/$(ENV_NAME) \
		$$($(GIT) rev-list -n1 $(TAG)):refs/tags/env/$(ENV_NAME)/$(MAKE_DATE)-$(MAKE_TIME)-$(TAG)
	$(GIT) fetch<commit_msg>less duplication, more semantics<commit_after>SF_PROMOTE_ENVS := \
	dev \
	prod-staging \
	prod \

# ------------------------------------------------------------------------------

.PHONY: promote/%
promote/%: ## promote/<env>/<tag> Promote tag to env branch.
	$(eval ENV_NAME := $(shell dirname "$*"))
	$(eval ENV_BRANCH := env/$(ENV_NAME))
	$(eval TAG := $(shell basename "$*"))
	$(eval TAG_COMMIT := $(shell $(GIT) rev-list -n1 $(TAG)))
	$(ECHO) "$(SF_PROMOTE_ENVS)" | $(GREP) -q -e "\(^\|\s\)$(ENV_NAME)\(\s\|$$\)" || { \
		$(ECHO_ERR) "$(ENV_NAME) is not a known env."; \
		exit 1; \
	}
	$(GIT) tag --list | $(GREP) -q "^$(TAG)$$" || { \
		$(ECHO_ERR) "$(TAG) is not a tag."; \
		exit 1; \
	}
	$(GIT) push -f $(GIT_REMOTE) \
		$(TAG_COMMIT):refs/heads/$(ENV_BRANCH) \
		$(TAG_COMMIT):refs/tags/$(ENV_BRANCH)/$(MAKE_DATE)-$(MAKE_TIME)-$(TAG)
	$(GIT) fetch
{'fraction_non_alphanumeric': 0.3465527760829774, 'fraction_numerical': 0.004270896888346553, 'mean_word_length': 2.3265720081135903, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1881857', 'n_tokens_mistral': 717, 'n_tokens_neox': 652, 'n_words': 134}