Re: pre-commit not working at server side push

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Jul 2011 12:13:56 +0530
"J. Bakshi" <joydeep@xxxxxxxxxxxxxxx> wrote:

> 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

seems it should be pre-receive hook at the server. So done accordingly but still not working 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]