git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bakshi" <joydeep@infoservices.in>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: pre-commit not working at server side push
Date: Wed, 20 Jul 2011 12:13:56 +0530	[thread overview]
Message-ID: <20110720121356.4dc21f6b@shiva.selfip.org> (raw)

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

             reply	other threads:[~2011-07-20  6:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20  6:43 J. Bakshi [this message]
2011-07-20  7:15 ` pre-commit not working at server side push 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110720121356.4dc21f6b@shiva.selfip.org \
    --to=joydeep@infoservices.in \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).