[Libreoffice] Git server-side hooks

Miklos Vajna vmiklos at frugalware.org
Wed Nov 17 15:57:51 PST 2010


Hi Kendy,

Tonight on IRC we had a discussion about two issues related to git
hooks:

1) Non-fastforwards (ie. pushing a rebase) are not allowed in repos at
all.

2) In case non-fastforwards are worked around by deleting the branch +
creating it again, the CIA bot spams the #libreoffice channel. (That
happened tonight when Kohei updated feature/calc-dp-unlimited-fields.)

Let's ignore the second problem for now. 1) is because the
receive.denyNonFastforwards setting is set to true in the repos.

Considering that keeping the history clean in a feature branch by
rebasing it from time to time sounds sane, I think we could do the
followings:

a) Disable receive.denyNonFastforwards in the config in each repo.
b) Enable the attached hook, that will still deny non-fastforwards in
   case the updated ref is not a feature branch.
c) Just to be safe, core.logallrefupdates could be set to true, so that
   a reflog will contain all the previous values of the refs, which means
   if someone did a 'git push -f' and updated a feature branch and it turns
   out it was a bad idea, the reflog can be still used to restore the
   branch's (good) old value.

Does this sound sane?

About 2) - is the script feeding the CIA bot public? I would like to
extend it so that in case of non-fastforwads and merges only the last
commit is announced to avoid spamming.

Thanks.
-------------- next part --------------
#!/bin/sh

while read oldrev newrev refname
do
    case $refname in
        refs/heads/feature/*)
            # we allow non-fastforwards here
            ;;
        *)
            if [ -n "$(git rev-list $newrev..$oldrev)" ]; then
                echo "Non-fastforward in non-feature branches is not allowed."
                exit 1
            fi
            ;;
    esac
done

# vim:set shiftwidth=4 softtabstop=4 expandtab:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101118/1afdaee0/attachment.pgp>


More information about the LibreOffice mailing list