2019-06-02 03:33:40 +08:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
2019-03-20 19:57:10 +08:00
|
|
|
# Links git hooks, if there are no other hooks already
|
|
|
|
|
|
|
|
if(NOT EXISTS "${SOF_ROOT_SOURCE_DIRECTORY}/.git")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT CMAKE_HOST_UNIX)
|
2019-05-21 17:16:09 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND sh -c echo
|
|
|
|
RESULT_VARIABLE sh_result
|
|
|
|
OUTPUT_QUIET
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT (sh_result STREQUAL "0"))
|
|
|
|
return()
|
|
|
|
endif()
|
2019-03-20 19:57:10 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(pre_commit_hook "${SOF_ROOT_SOURCE_DIRECTORY}/.git/hooks/pre-commit")
|
|
|
|
set(post_commit_hook "${SOF_ROOT_SOURCE_DIRECTORY}/.git/hooks/post-commit")
|
|
|
|
|
|
|
|
if(NOT EXISTS ${pre_commit_hook})
|
|
|
|
message(STATUS "Linking git pre-commit hook")
|
|
|
|
execute_process(COMMAND ln -s -f -T ../../scripts/sof-pre-commit-hook.sh ${pre_commit_hook})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT EXISTS ${post_commit_hook})
|
|
|
|
message(STATUS "Linking git post-commit hook")
|
|
|
|
execute_process(COMMAND ln -s -f -T ../../scripts/sof-post-commit-hook.sh ${post_commit_hook})
|
|
|
|
endif()
|