Skip to content

Commit

Permalink
Merge pull request #412 from koreader/houqp-master
Browse files Browse the repository at this point in the history
cmake(git module): avoid unecessary git fetch
  • Loading branch information
Frenzie committed Apr 22, 2016
2 parents ffdfa4c + 730a3d2 commit afaf36b
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions thirdparty/cmake_modules/koreader_thirdparty_git.cmake
Expand Up @@ -11,7 +11,8 @@ set(run 0)
######################################################################
# 1. if not cloned before, do a git clone
# 2. are we already at the given commit hash?
# 2.1. if not git fetch && checkout
# 2.1. checkout to the given commit hash
# 2.2. if checkout failed, git fetch && checkout again
# 4. git submodules update
# 5. copy everything over to source directory
######################################################################
Expand Down Expand Up @@ -68,21 +69,28 @@ if(should_clone)
endif()
if(NOT \"\${curr_tag}\" STREQUAL \"${git_tag}\")
execute_process(
COMMAND \"${git_EXECUTABLE}\" fetch
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
if(error_code)
message(FATAL_ERROR \"Failed to fetch update from origin\")
endif()
execute_process(
COMMAND \"${git_EXECUTABLE}\" checkout -f ${git_tag}
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
if(error_code)
message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
execute_process(
COMMAND \"${git_EXECUTABLE}\" fetch
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
if(error_code)
message(FATAL_ERROR \"Failed to fetch update from origin\")
endif()
execute_process(
COMMAND \"${git_EXECUTABLE}\" checkout -f ${git_tag}
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
if(error_code)
message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
endif()
endif()
endif()
Expand Down

0 comments on commit afaf36b

Please sign in to comment.