summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-05-20 22:37:40 +1000
committerCraig Scott <craig.scott@crascit.com>2021-05-20 22:39:04 +1000
commit8a9753e4279788ff30bd59c0a9f88392fa3cfd68 (patch)
tree597fb4ad47f6711a7296e230280ace92f29af58f
parentc23e2fa0c51ce1c7c4654da038e9d2cfcc944358 (diff)
downloadcmake-8a9753e4279788ff30bd59c0a9f88392fa3cfd68.tar.gz
ExternalProject: Only add git config setting with git 1.7.7 or later
1cb65e680d (ExternalProject: Prevent the noisy detached head messages on checkout, 2021-01-17) unconditionally added the advice.detachedHead git config setting, but it requires git 1.7.7 or later. Since it isn't fatal to not have it, just noisier, only add it when it is supported. Fixes: #22206
-rw-r--r--Modules/ExternalProject.cmake8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 56525080cc..90ed1ee63b 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2663,9 +2663,11 @@ function(_ep_add_download_command name)
get_property(git_progress TARGET ${name} PROPERTY _EP_GIT_PROGRESS)
get_property(git_config TARGET ${name} PROPERTY _EP_GIT_CONFIG)
- # Make checkouts quiet when checking out a git hash (this avoids the
- # very noisy detached head message)
- list(PREPEND git_config advice.detachedHead=false)
+ # If git supports it, make checkouts quiet when checking out a git hash.
+ # This avoids the very noisy detached head message.
+ if(GIT_VERSION_STRING VERSION_GREATER_EQUAL 1.7.7)
+ list(PREPEND git_config advice.detachedHead=false)
+ endif()
# For the download step, and the git clone operation, only the repository
# should be recorded in a configured RepositoryInfo file. If the repo