I am trying to do a post-receive hook on server side that will run some Python script once for each commit in push.
I have a loop:
while read oldrev newrev refname
do
python /local/Git/util.py $newrev $oldrev $refname
done
But this runs script only for last commit that was given in push.
There is any way to run script for all commits pushed to the server in one push?
In scripts, use git rev-list
to obtain the SHA-1s of commits in a range. In this case you should loop over the output from git rev-list $oldrev..$newrev
, e.g. like this:
git rev-list $oldrev..$newrev | while read rev ; do
python /local/Git/util.py $rev $oldrev $refname
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With