I'm using git with trac. After push I want two thing to be done:
The first thing is solved by git-commit-notifier. It works perfectly after I have created post-receive hook:
#!/bin/sh /var/lib/gems/1.8/bin/git-commit-notifier /etc/git-commit-notifier.yml
My second requirement can be solved as discribed at http://trac-hacks.org/wiki/GitPlugin#post-receivehookscripts. It also works perfectly with such post-receive hook:
#!/bin/sh /var/trac/testgit/commit-updater
Both 2 things works when they are separate. But I need to combine them. So I have created post-receive hook:
#!/bin/sh /var/trac/testgit/commit-updater /var/lib/gems/1.8/bin/git-commit-notifier /etc/git-commit-notifier.yml
It is very funny, but this is not working. The commands run perfectly well when the run separately, but only first one works when they are placed into post-receive hook.
If I have such hook:
#!/bin/sh /var/trac/testgit/commit-updater /var/lib/gems/1.8/bin/git-commit-notifier /etc/git-commit-notifier.yml
I do receive the following error
/var/lib/gems/1.8/gems/git-commit-notifier-0.8.0/bin/git-commit-notifier:12: undefined method `strip' for nil:NilClass (NoMethodError) from /var/lib/gems/1.8/bin/git-commit-notifier:19:in `load' from /var/lib/gems/1.8/bin/git-commit-notifier:19
But if I change to order of this 2 commands I do not receive any errors, but only the first command works.
I will appreciate any help. I'm trying to solve this problem for a long time and I have no ideas.
Assuming my comment is correct, and commit-updater
is eating all of stdin
, this should do the trick:
#!/bin/sh
FILE=`mktemp`
cat - > $FILE
cat $FILE | /var/trac/testgit/commit-updater
cat $FILE | /var/lib/gems/1.8/bin/git-commit-notifier /etc/git-commit-notifier.yml
rm $FILE