svn: /pear/packages/PHP_CodeSniffer/trunk/ package.xml scripts/phpcs-svn-pre-commit
| From: | Greg Sherwood | Date: | Mon, 03 Aug 2009 23:28:27 +0000 |
| Subject: | svn: /pear/packages/PHP_CodeSniffer/trunk/ package.xml scripts/phpcs-svn-pre-commit | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-56884@lists.php.net to get a copy of this message | ||
squiz Mon, 03 Aug 2009 23:28:27 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=286774
Log:
Fixed bug #16482 : phpcs-svn-pre-commit ignores extensions parameter. Needed to check file
extensions in the pre-commit hook itself.
Bug: http://pear.php.net/bugs/16482 (unknown)
Changed paths:
U pear/packages/PHP_CodeSniffer/trunk/package.xml
U pear/packages/PHP_CodeSniffer/trunk/scripts/phpcs-svn-pre-commit
Modified: pear/packages/PHP_CodeSniffer/trunk/package.xml
===================================================================
--- pear/packages/PHP_CodeSniffer/trunk/package.xml 2009-08-03 23:27:47 UTC (rev 286773)
+++ pear/packages/PHP_CodeSniffer/trunk/package.xml 2009-08-03 23:28:27 UTC (rev 286774)
@@ -31,6 +31,7 @@
- Fixed bug #16424 : SubversionPropertiesSniff print PHP Warning
- Fixed bug #16450 : Constant PHP_CODESNIFFER_VERBOSITY already defined (unit tests)
- Fixed bug #16453 : function declaration long line splitted error
+ - Fixed bug #16482 : phpcs-svn-pre-commit ignores extensions parameter
</notes>
<contents>
<dir name="/">
Modified: pear/packages/PHP_CodeSniffer/trunk/scripts/phpcs-svn-pre-commit
===================================================================
--- pear/packages/PHP_CodeSniffer/trunk/scripts/phpcs-svn-pre-commit 2009-08-03 23:27:47 UTC (rev
286773)
+++ pear/packages/PHP_CodeSniffer/trunk/scripts/phpcs-svn-pre-commit 2009-08-03 23:28:27 UTC (rev
286774)
@@ -1,4 +1,4 @@
-#!@php_bin@
+#!/usr/bin/php
<?php
/**
* A commit hook for SVN.
@@ -138,6 +138,14 @@
continue;
}
+ // We need to check file extensions ourself because they are
+ // not checked when processing a single file.
+ $fileParts = explode('.', $path);
+ $extension = array_pop($fileParts);
+ if (isset($phpcs->allowedFileExtensions[$extension]) === false) {
+ continue;
+ }
+
// Get the contents of each file, as it would be after this transaction.
$command = PHP_CODESNIFFER_SVNLOOK.' cat '.implode(' ',
$values['svnArgs']).' '.$path;
$handle = popen($command, 'r');