Well it works.
My pre-receive hook is now :
#!/bin/bash
#
# pre-receive hook for v1
#
check_commit()
{
COMMIT_STATUS=0
#
# Add your commit check strategy here
# Set COMMIT_STATUS to non 0, if you want to make it fail
#
}
process_revisions()
{
REVISIONS=$(git rev-list $OLD_REVISION..$NEW_REVISION)
IFS='\n' read -ra LIST_OF_REVISIONS <<< "$REVISIONS"
for rid in "${!LIST_OF_REVISIONS[@]}"; do
REVISION=${LIST_OF_REVISIONS[rid]}
COMMIT_MESSAGE=$(git cat-file commit $REVISION | sed '1,/^$/d')
COMMIT_AUTHOR=$(git cat-file commit $REVISION | grep committer | sed
's/^.* \([^@ ]\+@[^ ]\+\) \?.*$/\1/')
check_commit
if [ "$COMMIT_STATUS" != "0" ]; then
echo "Commit validation failed for commit $REVISION" >&2
exit 1
fi
done
}
# enforced custom commit message format
while read OLD_REVISION NEW_REVISION REFNAME ; do
process_revisions
done
exit 0
2015-03-02 17:00 GMT+01:00 tombert <[email protected]>:
> Would be great if you post how you got it working ... because the scripts
> there are 7 months old, and since then GitLab changed the way hooks are
> working.
>
> --
> You received this message because you are subscribed to the Google Groups
> "GitLab" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gitlabhq/c954e69b-5af5-4388-8a06-0810eeab238e%40googlegroups.com
> <https://groups.google.com/d/msgid/gitlabhq/c954e69b-5af5-4388-8a06-0810eeab238e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/gitlabhq/CALyUpY2xUH1qft%2BL3QBAi5B-%3DFtSpyt6gB5jig69%2B_PDR13Ufg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.