diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-05-09 02:33:16 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-05-09 02:33:16 (GMT) |
commit | 5e941a545bf5882ddf101cad383dc815fb651f26 (patch) | |
tree | ae3f6b468a3cfb2c8fec86eba4c6455b104521aa /Tests/RunCMake/ExternalProject/FetchGitRefs | |
parent | fdbb5a599fc373a1ec7dbbfdcca34ff9669f3c48 (diff) | |
download | CMake-5e941a545bf5882ddf101cad383dc815fb651f26.zip CMake-5e941a545bf5882ddf101cad383dc815fb651f26.tar.gz CMake-5e941a545bf5882ddf101cad383dc815fb651f26.tar.bz2 |
ExternalProject: Ensure git fetch if updating to hash we don't have yet
In ac6a4d4884 (ExternalProject: Improve robustness of update step,
2020-10-17), the method used to check whether we already have a
commit or not was changed from using git rev-list to git rev-parse.
The new logic assumed rev-parse would output nothing if given a commit
hash it didn't know about, but it simply prints the hash again without
raising an error in this scenario. Amend that logic by adding ^{commit} to
the ref to ensure we do get an error if that ref is not currently known.
Fixes: #22166
Diffstat (limited to 'Tests/RunCMake/ExternalProject/FetchGitRefs')
-rw-r--r-- | Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt b/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt new file mode 100644 index 0000000..d9a380c --- /dev/null +++ b/Tests/RunCMake/ExternalProject/FetchGitRefs/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.19) +project(FetchTags LANGUAGES NONE) + +include(ExternalProject) + +# repoDir and gitTag are expected to be set as cache variables + +ExternalProject_Add(fetcher + GIT_REPOSITORY ${repoDir} + GIT_TAG ${gitTag} + GIT_REMOTE_UPDATE_STRATEGY CHECKOUT + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) |