2 #=============================================================================
3 # CMake - Cross Platform Makefile Generator
4 # Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
6 # Distributed under the OSI-approved BSD License (the "License");
7 # see accompanying file Copyright.txt for details.
9 # This software is distributed WITHOUT ANY WARRANTY; without even the
10 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # See the License for more information.
12 #=============================================================================
15 echo 'pre-commit hook failure' 1>&2
16 echo '-----------------------' 1>&2
22 #-------------------------------------------------------------------------------
24 bad=$(regex=".{$line_too_long}" &&
25 git diff-index --cached HEAD --name-only --diff-filter=AM \
26 --pickaxe-regex -S"$regex" -- 'Source/*.h' 'Source/*.cxx' |
28 lines_too_long=$(git diff-index -p --cached HEAD \
29 --pickaxe-regex -S"$regex" -- "$file")
30 if echo "$lines_too_long" | egrep -q '^\+'"$regex"; then
31 echo "$lines_too_long"
35 die 'The following changes add lines too long for our C++ style:
39 Use lines strictly less than '"$line_too_long"' characters in C++ code.'
41 #-------------------------------------------------------------------------------
42 if test -z "$HOOKS_ALLOW_KWSYS"; then
43 # Disallow changes to KWSys
44 files=$(git diff-index --name-only --cached HEAD -- Source/kwsys) &&
45 if test -n "$files"; then
46 die 'Changes to KWSys files
48 '"$(echo "$files" | sed 's/^/ /')"'
50 cannot be committed through Git. KWSys is kept in a CVS repository
51 shared by several projects. A robot replays changes committed there
52 into the Source/kwsys directory in CMake. Please send changes to
53 this directory separately. Run
55 git reset HEAD -- Source/kwsys
57 to unstage these changes and then
59 git diff -- Source/kwsys > kwsys.patch
61 to construct the patch. Alternatively, set environment variable
65 to disable this check and commit the changes locally.'