Git post-receive pipeline although commits everything

I am trying to do a post hooking hook on the server side that will run multiple Python script once for every commit in a push.

I have a loop:

while read oldrev newrev refname
do
    python /local/Git/util.py $newrev $oldrev $refname
done

      

But this script is only executed for the last commit that was given in push.

Is there a way to run a script for all commits pushed to the server with one click?

+3


source to share


1 answer


In scripts, use git rev-list

to get SHA-1 commits in range. In this case, you have to iterate over the output from git rev-list $oldrev..$newrev

eg. eg:



git rev-list $oldrev..$newrev | while read rev ; do
    python /local/Git/util.py $rev $oldrev $refname
done

      

+4


source







All Articles