git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pre-commit not working at server side push
@ 2011-07-20  6:43 J. Bakshi
  2011-07-20  7:15 ` J. Bakshi
  2011-07-20  7:18 ` Ilari Liusvaara
  0 siblings, 2 replies; 7+ messages in thread
From: J. Bakshi @ 2011-07-20  6:43 UTC (permalink / raw)
  To: git@vger.kernel.org

Hello list,

I have this bash script to check php syntax error and prevent the commit if there is any

```````````````````
#!/bin/sh

##php_syntax_check

  for i in $(git diff-index --name-only --cached HEAD -- | grep -E '\.(php|engine|theme|install|inc>
        if [ -f $i ]; then
                output=$(/usr/bin/php5 -l $i)
                if [ "$output" == "No syntax errors detected in $i" ];
                then
                        echo "PHP syntax check for $i: OK"
                else
                        echo "=====================================================================>
                        echo "Pause $i for the commit due to PHP parse errors:"
                        echo "$output"
                        exit 1
                fi
        fi
    done

```````````````````

Running fine when placed it at local copy.

I have placed the hook at the server under hooks directory and provided the execute permission also

$ chmod a+x hooks/pre-commit

But even with wrong php syntax I am able to push the file. Have I missed something ?

Thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-20  9:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-20  6:43 pre-commit not working at server side push J. Bakshi
2011-07-20  7:15 ` J. Bakshi
2011-07-20  7:30   ` Ilari Liusvaara
2011-07-20  7:45     ` J. Bakshi
2011-07-20  9:03       ` J. Bakshi
2011-07-20  7:18 ` Ilari Liusvaara
2011-07-20  7:21   ` J. Bakshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).