diff options
author | Nicolas Capens <capn@google.com> | 2022-04-18 00:36:49 -0400 |
---|---|---|
committer | Nicolas Capens <nicolascapens@google.com> | 2022-04-20 16:58:20 +0000 |
commit | 3acaa53a16419e1eff93c1af54385153f5f88609 (patch) | |
tree | 2f67faf821eaaf87b12f6280647bc0f720cda881 | |
parent | 88fe9ce05ec8624489c87e8f03edfa1be7463f35 (diff) | |
download | swiftshader-3acaa53a16419e1eff93c1af54385153f5f88609.tar.gz |
Automate downloading .git/hooks/commit-msg
SwiftShader's Gerrit Git host was recently configured to require a
Change-Id in every commit message before accepting a pushed change
for review. This CL makes CMake download the commit hook script which
adds this Change-Id line, if not present, and makes it executable.
Bug: Automate commit hook download.
Change-Id: I627941b906f7fff54832d200b243dfc7a88ca479
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/65129
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Sean Risser <srisser@google.com>
-rw-r--r-- | CMakeLists.txt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ff561345..c69489c00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,27 @@ if(CCACHE_FOUND) endif() ########################################################### +# Install Gerrit commit hook +########################################################### + +if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/commit-msg) + message(WARNING " + .git/hooks/commit-msg was not found. + Downloading from https://gerrit-review.googlesource.com/tools/hooks/commit-msg... + ") + + file(DOWNLOAD https://gerrit-review.googlesource.com/tools/hooks/commit-msg ${CMAKE_SOURCE_DIR}/commit-msg) + + file(COPY ${CMAKE_SOURCE_DIR}/commit-msg + DESTINATION ${CMAKE_SOURCE_DIR}/.git/hooks/ + FILE_PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_WRITE GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE) + file(REMOVE ${CMAKE_SOURCE_DIR}/commit-msg) +endif() + +########################################################### # Host libraries ########################################################### |