Use shallow clone for git repositories by default (#129) (#130)

* Use shallow clone for git repositories by default (#129)

* use shallow clone for git repositories by default

* remove trailing spaces

* Enable shallow clone for actual tags

* Support short commit hash

* Enable shallow only when downloading dependencies into cache

* Always honor user specified GIT_SHALLOW opiton
This commit is contained in:
Kingsley Chen
2020-06-15 15:27:26 +08:00
committed by GitHub
parent 139d3cacba
commit 392b2a864b
2 changed files with 64 additions and 13 deletions

View File

@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
include(${CPM_PATH}/CPM.cmake)
include(${CPM_PATH}/testing.cmake)
CPM_IS_GIT_TAG_COMMIT_HASH("v1.2.3" RESULT)
ASSERT_EQUAL("0" ${RESULT})
CPM_IS_GIT_TAG_COMMIT_HASH("asio-1-12-1" RESULT)
ASSERT_EQUAL("0" ${RESULT})
CPM_IS_GIT_TAG_COMMIT_HASH("513039e3cba83284cec71287fd829865b9f423bc" RESULT)
ASSERT_EQUAL("1" ${RESULT})
CPM_IS_GIT_TAG_COMMIT_HASH("513039E3CBA83284CEC71287FD829865B9F423BC" RESULT)
ASSERT_EQUAL("1" ${RESULT})
CPM_IS_GIT_TAG_COMMIT_HASH("513039E" RESULT)
ASSERT_EQUAL("1" ${RESULT})
CPM_IS_GIT_TAG_COMMIT_HASH("513039E3CBA8" RESULT)
ASSERT_EQUAL("1" ${RESULT})