summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-06-20 15:40:45 +1000
committerCraig Scott <craig.scott@crascit.com>2021-06-20 15:40:45 +1000
commit360ff17dc6e3dba2af56b13fa43b246633e13465 (patch)
treeff40f8d58d89e61d42de337c3bcc5eaf590d8d46
parentacd82e46906cbd53cdce355456e43e224777a4ba (diff)
downloadcmake-360ff17dc6e3dba2af56b13fa43b246633e13465.tar.gz
ExternalProject: Use ${ref}^0 to avoid MSYS/Cygwin shell substitutions
In 5e941a545b (ExternalProject: Ensure git fetch if updating to hash we don't have yet, 2021-05-09), the form ${ref}^{commit} was used to ensure the ref was treated as a commit. When running under a MSYS2 or Cygwin shell, the {commit} part can be translated by the shell, leaving it as ${ref}^commit, which git doesn't understand. Use the equivalent but safer form ${ref}^0, since it won't be subject to the shell substitution issue. Fixes: #22299
-rw-r--r--Modules/ExternalProject-gitupdate.cmake.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/ExternalProject-gitupdate.cmake.in b/Modules/ExternalProject-gitupdate.cmake.in
index 461e323540..0de2372ecf 100644
--- a/Modules/ExternalProject-gitupdate.cmake.in
+++ b/Modules/ExternalProject-gitupdate.cmake.in
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.5)
function(get_hash_for_ref ref out_var err_var)
execute_process(
- COMMAND "@git_EXECUTABLE@" rev-parse "${ref}^{commit}"
+ COMMAND "@git_EXECUTABLE@" rev-parse "${ref}^0"
WORKING_DIRECTORY "@work_dir@"
RESULT_VARIABLE error_code
OUTPUT_VARIABLE ref_hash