Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


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.
#!/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:

Attachment: pgptclOMnwTth.pgp
Description: PGP signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.