From fe33aeb3dc19d07330da7f3a750904e054f37dd4 Mon Sep 17 00:00:00 2001 From: spring2maz Date: Fri, 30 Nov 2018 06:52:29 +0100 Subject: [PATCH] For git older than 1.8, there is no shallow clone support --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bedeb7250..e815e0756 100644 --- a/Makefile +++ b/Makefile @@ -48,9 +48,16 @@ PLT_APPS = sasl asn1 ssl syntax_tools runtime_tools crypto xmerl os_mon inets pu DIALYZER_DIRS := ebin/ DIALYZER_OPTS := --verbose --statistics -Werror_handling -Wrace_conditions #-Wunmatched_returns +GIT_VSN = $(shell git --version | grep -oE "[0-9]{1,2}\.[0-9]{1,2}") +GIT_VSN_17_COMP = $(shell echo -e "$(GIT_VSN)\n1.7" | sort -V | tail -1) +ifeq ($(GIT_VSN_17_COMP),1.7) + MAYBE_SHALLOW = +else + MAYBE_SHALLOW = -c advice.detachedHead=false --depth 1 +endif + define dep_fetch_git-emqx - git clone -q --depth 1 -b $(call dep_commit,$(1)) -- $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)) > /dev/null 2>&1; \ - cd $(DEPS_DIR)/$(call dep_name,$(1)); + git clone $(MAYBE_SHALLOW) -q -b $(call dep_commit,$(1)) -- $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)) > /dev/null 2>&1 endef core_http_get-emqx = curl -Lf$(if $(filter-out 0,$(V)),,s)o $(call core_native_path,$1) $2