diff --git a/README.md b/README.md index 0aeb942..66cc1ed 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,7 @@ Setup - CMake: `pip install --user cmake_format` - Python: `pip install --user python-autopep8 pylint` 1. Ensure that `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` is included in the `cmake_args` of your catkin profile. It is already added to the default profile, but if you have created your own catkin profile, you need to add the flag with `catkin config -a --cmake-args "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"`) -2. If you use `aduulm_cmake_tooks`, you can include the git hooks in any of your packages' toplevel `CMakeList.txt` with a call to `setup_git_hooks()`. Otherwise, you may add the following code block explicitly (not recommended): -```cmake -set(HOOKS_PATH "${CMAKE_BINARY_DIR}/../../root/git_hooks") -if(EXISTS "${HOOKS_PATH}") - add_subdirectory("${HOOKS_PATH}" "${CMAKE_CURRENT_BINARY_DIR}/.hooks") - create_git_hook() -else() - message(WARNING "Could not find git hooks. Git hooks are not active.") -endif() -``` +2. If you use `aduulm_cmake_tooks`, you can include the git hooks in any of your packages' toplevel `CMakeList.txt` with a call to `setup_git_hooks()`. Otherwise, you may add the git_hooks repository as a submodule of your own repository with ` git submodule add "ssh://git@mrm-git.e-technik.uni-ulm.de:7678/aduulm/source/git_hooks.git" git_hooks` and then include it with `add_subdirectory("git_hooks")` and `setup_git_hooks()`. 3. Run `catkin build` or `catkin build PROJECT_NAME` 4. Check that `./run_hooks` and `$(git rev-parse --git-dir)/hooks/pre-commit` exist 5. Add `run_hooks` to your .gitignore file diff --git a/init.sh b/init.sh index e8fb7fe..2189333 100755 --- a/init.sh +++ b/init.sh @@ -8,6 +8,7 @@ HOOKSPATH="$( cd "$(dirname "$0")" ; pwd -P )" GIT_DIR=`readlink -f $(git rev-parse --git-dir)` REPOPATH=`realpath "$1"` PROJECT_NAME=${REPOPATH##*/} +HOOKSPATH_REL=`realpath --relative-to="$REPOPATH" "$HOOKSPATH"` if [ -f "$REPOPATH/CMakeLists.txt" ]; then echo "Folder already contains CMakeLists.txt!" >&2 @@ -18,7 +19,7 @@ cat <"$REPOPATH/CMakeLists.txt" cmake_minimum_required(VERSION 2.8.3) project($PROJECT_NAME) -add_subdirectory("$HOOKSPATH" ".hooks") +add_subdirectory("$HOOKSPATH_REL" ".hooks") create_git_hook() EOF