|Think about Loose Coupling|
Update: problem solved = bug in Gitby tomgracey (Beadle)
|on Jul 12, 2013 at 09:18 UTC||Need Help??|
Very big hat off to the real wizard on google groups "git for human beings" who solved this conundrum (I wont say who as I haven't asked for permission - but you can find the thread under the title 'frustrations trying to control git through apache'). Here is an extract of his diagnosis:
So we see that:
1) The Git code is poorly documented, and there is no coding control to ensure that the code is internally documented.
2) The test "if (fd > 0) return fd;" is incorrect. It should be "(fd >= 0)".
3) The error is triggered if fd 0 (standard-input) is closed when Git starts and Git needs to put a file into the object store. In your situation, that is determined by the particular Git operation and the details of how Git is invoked by Apache.
From this, we can construct a simple test case that demonstrates the bug:
So there you have it. Nothing to do with environment variables, and mod_perl was a red herring
Add </dev/null to any (bash) line being executed that involves a write (or otherwise ensure standard input is not closed when git tries to open the file). Unfortunately this appears to mean *any* git module (Git::Wrapper, Git::Repository... ) is unusable for me (and I would be surprised if not for other people aswell?), and I must use home grown code...
Btw the bug has been reported
And now it works! I am so happy =D