Permalink
Browse files

COMP: Complain if git config "insteadof" are not as expected

See http://na-mic.org/Mantis/view.php?id=2731

Fixes #2731

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21319 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
jcfr committed Nov 6, 2012
1 parent 96932f6 commit b9497796cd417c84e13ae566c662e333973f26bd
Showing with 22 additions and 0 deletions.
  1. +22 −0 SuperBuild.cmake
View
@@ -26,6 +26,28 @@ option(${CMAKE_PROJECT_NAME}_USE_GIT_PROTOCOL "If behind a firewall turn this of
set(git_protocol "git")
if(NOT ${CMAKE_PROJECT_NAME}_USE_GIT_PROTOCOL)
set(git_protocol "http")
+
+ # Verify that the global git config has been updated with the expected "insteadOf" option.
+ function(_check_for_required_git_config_insteadof base insteadof)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} config --global --get "url.${base}.insteadof"
+ OUTPUT_VARIABLE output
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE error_code
+ )
+ if(error_code OR NOT "${output}" STREQUAL "${insteadof}")
+ message(FATAL_ERROR
+"Since the ExternalProject modules doesn't provide a mechanism to customize the clone step by "
+"adding 'git config' statement between the 'git checkout' and the 'submodule init', it is required "
+"to manually update your global git config to successfully build ${CMAKE_PROJECT_NAME} with "
+"option ${CMAKE_PROJECT_NAME}_USE_GIT_PROTOCOL set to FALSE. "
+"See http://na-mic.org/Mantis/view.php?id=2731"
+"\nYou could do so by running the command:\n"
+" ${GIT_EXECUTABLE} config --global url.\"${base}\".insteadOf \"${insteadof}\"\n")
+ endif()
+ endfunction()
+
+ _check_for_required_git_config_insteadof("http://itk.org/" "git://itk.org/")
endif()
#-----------------------------------------------------------------------------

0 comments on commit b949779

Please sign in to comment.