From 6f3838c034e652b90d9c2571851729313880a328 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 31 Mar 2017 12:53:51 -0400 Subject: ExternalProject: Fix regression in GIT_TAG with remote branch name The change in commit v3.8.0-rc2~7^2 (ExternalProject: Run `git checkout` with `--` to clarify arguments, 2017-02-24) broke the case of `GIT_TAG some-remote-branch` because an explicit `--` means that the preceding argument is a tree-ish instead of a branch. Revert the change and leave a comment. Fixes: #16763 --- Modules/ExternalProject.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 00781d6..b42d2dd 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -600,8 +600,11 @@ if(error_code) message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\") endif() +# Use `git checkout ` even though this risks ambiguity with a +# local path. Unfortunately we cannot use `git checkout --` +# because that will not search for remote branch names, a common use case. execute_process( - COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag} -- + COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) -- cgit v0.12