]> git.saurik.com Git - wxWidgets.git/blame - misc/scripts/svn/hooks/pre-commit
Fix bug in the hook which prevented committing makefiles.
[wxWidgets.git] / misc / scripts / svn / hooks / pre-commit
CommitLineData
078a94e0
VZ
1#!/bin/sh
2
3REPOS="$1"
4TXN="$2"
5
6SVNLOOK=/usr/bin/svnlook
7
3347f618
VZ
8svn_cat() {
9 $SVNLOOK cat "$REPOS" -t "$TXN" $1
10}
11
12all_changed_files=`$SVNLOOK changed "$REPOS" -t "$TXN" | \
078a94e0 13 grep "^[AU]" | \
3347f618
VZ
14 sed 's/^....//'`
15
95e74456
VZ
16# notice that breaking all_changed_files into several lines by replacing spaces
17# with new lines only works as long as we don't have any files with spaces in
18# them -- which is the case for now, but if it ever changes we'd probably need
19# to use a shell array for all_changed_files or just rerun svnlook here again
3347f618 20changed_sources=`echo $all_changed_files | \
95e74456 21 sed 's/ /\n/g' | \
078a94e0 22 egrep "\.(cpp|h|py)$" | \
3347f618 23 egrep -v "src/(tiff|regex|jpeg|stc/scintilla)"`
078a94e0
VZ
24
25rc=0
26
27set -e
3347f618
VZ
28
29for f in $changed_sources; do
30 if svn_cat $f | fgrep -q ' '; then
078a94e0
VZ
31 echo "Please remove TABs from $f before committing." >&2
32 rc=1
33 fi
34done
35
3347f618
VZ
36for f in $all_changed_files; do
37 if ! svn_cat $f | iconv -f utf8 -t WCHAR_T > /dev/null; then
38 echo "File $f doesn't use UTF-8, please convert it before committing." >&2
39 rc=1
40 fi
41done
42
078a94e0 43exit $rc