I just blogged about automatically running PHP Lint when committing a file into the repo. Well I also had the joy of it failing because I removed a file.
If you get “Could not open input file: abc.php”, then you may have the same problem I did.
There’s an easy solution. The pre-commit file looks for all changed files. Technically, a removed file is changed, but it also doesn’t exist when you go to run php -l against it.
Open your pre-commit file, and change the line that looks like this:
exec(“git diff-index –cached –name-only {$against}”, $output);
to
exec(“git diff-index –diff-filter=ACMRTUXB –cached –name-only {$against}”, $output);