diff options
author | Craig Scott <craig.scott@crascit.com> | 2020-05-29 11:40:15 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-05-29 16:10:32 (GMT) |
commit | e71c2807ba173f80df5b1fceb0d84a0bda4e5e88 (patch) | |
tree | 0e10e5c064474471f75339a2d52ad3b56acde8ff /Tests | |
parent | 1336d11d9ceabf070b75816b91c7ae9459f0817c (diff) | |
download | CMake-e71c2807ba173f80df5b1fceb0d84a0bda4e5e88.zip CMake-e71c2807ba173f80df5b1fceb0d84a0bda4e5e88.tar.gz CMake-e71c2807ba173f80df5b1fceb0d84a0bda4e5e88.tar.bz2 |
ExternalProject: Remote checkout needs to include the remote name
Commit 0aea435aa1 (ExternalProject: Provide choice of
git update strategies, 2020-02-12) added the git update
strategies, but the CHECKOUT strategy was not handling
remote refs correctly. The local ref would be checked out
instead and no warning or error would have been emitted.
The test that should have caught this was also malformed
and did not actually move the local master branch as intended.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake index ba0c598..ddc513f 100644 --- a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake +++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -199,8 +199,14 @@ if(do_git_tests) foreach(strategy IN ITEMS CHECKOUT REBASE_CHECKOUT) # Move local master back, then apply a change that will cause a conflict - # during rebase. We want to test the fallback to checkout. - check_a_tag(master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 REBASE) + # during rebase + execute_process(COMMAND ${GIT_EXECUTABLE} checkout master + WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep1-GIT + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR "Could not reset local master back to tag1.") + endif() execute_process(COMMAND ${GIT_EXECUTABLE} reset --hard tag1 WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep1-GIT RESULT_VARIABLE error_code @@ -208,6 +214,7 @@ if(do_git_tests) if(error_code) message(FATAL_ERROR "Could not reset local master back to tag1.") endif() + set(cmlFile ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep1-GIT/CMakeLists.txt) file(READ ${cmlFile} contents) string(REPLACE "find TutorialConfig.h" "find TutorialConfig.h (conflict here)" @@ -222,7 +229,7 @@ if(do_git_tests) message(FATAL_ERROR "Could not commit conflicting change.") endif() # This should discard our commit but leave behind an annotated tag - check_a_tag(master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 ${strategy}) + check_a_tag(origin/master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 ${strategy}) endforeach() endif() |