-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable GINKGO_DEVEL_TOOLS by default
This PR sets the default for GINKGO_DEVEL_TOOLS to OFF to make it easier for users to use our library even though they don't have the necessary tools (especially clang-format) installed. To not break our workflow, it adds a dummy pre-commit hook that is installed when DEVEL_TOOLS is off and rejects every commit with a reminder message. The hook is not installed when the git-cmake-format hook is already present. Closes #440 Related PR: #442
- Loading branch information
Showing
5 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
if(EXISTS "${Ginkgo_SOURCE_DIR}/.git") | ||
set(ADD_HOOK FALSE) | ||
set(HOOK_LOCATION "${Ginkgo_SOURCE_DIR}/.git/hooks/pre-commit") | ||
if(NOT EXISTS "${HOOK_LOCATION}") | ||
set(ADD_HOOK TRUE) | ||
else() | ||
# check if the correct hook is installed | ||
execute_process(COMMAND grep git-cmake-format.py "${HOOK_LOCATION}" | ||
RESULT_VARIABLE res OUTPUT_QUIET) | ||
# return value =/= 0 means the pattern was not found | ||
if(NOT res EQUAL 0) | ||
set(ADD_HOOK TRUE) | ||
endif() | ||
endif() | ||
if(ADD_HOOK) | ||
configure_file(dummy_hook "${HOOK_LOCATION}" COPYONLY) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
echo "Please only commit to Ginkgo when GINKGO_DEVEL_TOOLS is enabled in CMake." | ||
echo "This can be set in your initial invocation of CMake by using" | ||
echo " -DGINKGO_DEVEL_TOOLS=ON or by editing the CMakeCache.txt file." | ||
exit 1 |