From 078a94e00d4922cadb7682c38add735865c6c1b5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 18 Sep 2009 16:28:04 +0000 Subject: [PATCH] Add the initial version of svn pre-commit hook. This version checks for absence of hard TABs in our source files. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61963 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- misc/scripts/svn/hooks/pre-commit | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 misc/scripts/svn/hooks/pre-commit diff --git a/misc/scripts/svn/hooks/pre-commit b/misc/scripts/svn/hooks/pre-commit new file mode 100755 index 0000000000..9cacb13d44 --- /dev/null +++ b/misc/scripts/svn/hooks/pre-commit @@ -0,0 +1,24 @@ +#!/bin/sh + +REPOS="$1" +TXN="$2" + +SVNLOOK=/usr/bin/svnlook + +changed_cpp_files=`$SVNLOOK changed "$REPOS" -t "$TXN" | \ + grep "^[AU]" | \ + sed 's/^....//' | \ + egrep "\.(cpp|h|py)$" | \ + egrep -v "src/(tiff|regex|jpeg|stc/scintilla)" ` + +rc=0 + +set -e +for f in $changed_cpp_files; do + if $SVNLOOK cat "$REPOS" -t "$TXN" $f | fgrep -q ' '; then + echo "Please remove TABs from $f before committing." >&2 + rc=1 + fi +done + +exit $rc -- 2.45.2