git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* process committed files in post-receive hook
@ 2011-12-10 10:29 Hao
  2011-12-10 11:21 ` Michael Schubert
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Hao @ 2011-12-10 10:29 UTC (permalink / raw)
  To: git

Hi guys,

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.

I have two questions. First, is there a way that I can access file content in a 
bare repo without checking out a working copy? If this is not possible, my 
approach would be reasonable. However, when 'git pull' was called in the python 
script post-receive when a commit occurs, it gives an error.

remote: fatal: Not a git repository: '.'

The call in python is

subprocess.Popen(["git", "pull"], cwd="/Users/git/ts.git.workingcopy")

I read from a post (http://stackoverflow.com/questions/4043609/) that GIT_DIR is 
causing this error. Is it safe to unset GIT_DIR in post-receive?

Thanks a lot.

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

end of thread, other threads:[~2011-12-15  8:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-10 10:29 process committed files in post-receive hook Hao
2011-12-10 11:21 ` Michael Schubert
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

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).