Use list for the tags completion table, not obarray
[emacs.git] / build-aux / git-hooks / pre-commit
blob8bce1f5ade014a6340506323ce2c675e945c1335
1 #!/bin/sh
2 # Check file names in git commits for GNU Emacs.
4 # Copyright 2014-2015 Free Software Foundation, Inc.
6 # This file is part of GNU Emacs.
8 # GNU Emacs is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # GNU Emacs is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21 LC_ALL=C
22 export LC_ALL
24 exec >&2
26 . git-sh-setup
28 git_diff='git diff --cached --name-only --diff-filter=A'
29 ok_chars='\0+[=-=]./0-9A-Z_a-z'
30 nbadchars=`$git_diff -z HEAD | tr -d "$ok_chars" | wc -c`
32 if test "$nbadchars" -ne 0; then
33 echo "File name does not consist of -+./_ or ASCII letters or digits."
34 exit 1
37 for new_name in `$git_diff HEAD`; do
38 case $new_name in
39 -* | */-*)
40 echo "$new_name: File name component begins with '-'."
41 exit 1;;
42 ChangeLog | */ChangeLog)
43 echo "$new_name: Please use git commit messages, not ChangeLog files."
44 exit 1;;
45 esac
46 done
48 exec git diff-index --check --cached HEAD --