git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Schubert <mschub@elegosoft.com>
To: Hao <billhao@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: process committed files in post-receive hook
Date: Sat, 10 Dec 2011 12:21:54 +0100	[thread overview]
Message-ID: <4EE340D2.200@elegosoft.com> (raw)
In-Reply-To: <loom.20111210T111457-837@post.gmane.org>

On 12/10/2011 11:29 AM, Hao wrote:
> I am writing a post-receive hook in Python that examines the content of some 
> files (the HEAD rev). Because the repo is a bare one on the server. My current 
> approach is to check out a working copy on the server and run 'git pull' in post-
> receive to get the most up-to-date version, and then process files in the 
> working copy.

You could do something like this as a post-receive hook:

#!/bin/sh

test_dir=$(mktemp -d /tmp/test.XXXXXXXXXX)
GIT_WORK_TREE=$test_dir git checkout -f
/usr/local/bin/check.py $test_dir
rm -rf $test_dir

  reply	other threads:[~2011-12-10 11:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 10:29 process committed files in post-receive hook Hao
2011-12-10 11:21 ` Michael Schubert [this message]
2011-12-10 12:06   ` Ivan Heffner
2011-12-10 21:31 ` Alexey Shumkin
2011-12-15  1:04 ` Neal Kreitzinger
2011-12-15  2:02   ` Hao Wang
2011-12-15  7:23     ` Jeff King
2011-12-15  8:19       ` Hao Wang

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=4EE340D2.200@elegosoft.com \
    --to=mschub@elegosoft.com \
    --cc=billhao@gmail.com \
    --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).