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/>.
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."
37 for new_name
in `$git_diff HEAD`; do
40 echo "$new_name: File name component begins with '-'."
42 ChangeLog |
*/ChangeLog
)
43 echo "$new_name: Please use git commit messages, not ChangeLog files."
48 exec git diff-index
--check --cached HEAD
--