Louis Dionne via llvm-dev
2018-Nov-09 19:33 UTC
[llvm-dev] [monorepo] Pre-push hook to prevent pushing merge commits
Hi, At the LLVM dev meeting, some people discussed the possibility of having pre-push and/or pre-commit hooks to avoid messing up the history when we move on to the monorepo. One of the concerns was about people starting to push merge commits and unsquashed commits upstream, resulting in a messy history. I had volunteered to write a hook that would check for the absence of merge commits in the set of commits being pushed upstream, which I did. The hook is available here: https://gist.github.com/ldionne/2c260ce2081db74206e074e09cff71d0 <https://gist.github.com/ldionne/2c260ce2081db74206e074e09cff71d0>. If there is any interest for something like this, the code’s there. Cheers, Louis -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181109/8b7d156c/attachment.html>
Roman Lebedev via llvm-dev
2018-Nov-09 19:40 UTC
[llvm-dev] [monorepo] Pre-push hook to prevent pushing merge commits
On Fri, Nov 9, 2018 at 10:33 PM Louis Dionne via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi, > > At the LLVM dev meeting, some people discussed the possibility of having pre-push and/or pre-commit hooks to avoid messing up the history when we move on to the monorepo. One of the concerns was about people starting to push merge commits and unsquashed commits upstream, resulting in a messy history. > > I had volunteered to write a hook that would check for the absence of merge commits in the set of commits being pushed upstream, which I did. The hook is available here: https://gist.github.com/ldionne/2c260ce2081db74206e074e09cff71d0. > > If there is any interest for something like this, the code’s there.I would like to note that it is a client-side hook. So every one would need to install it. To be actually able to prevent such things, it needs to be centralized, server-side hook. (I don't think you can have server-side hooks on github, so if that is required, the master (as in, not a mirror, but the one you commit things into) git monorepo can't be located on github..)> Cheers, > LouisRoman.> _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
David Greene via llvm-dev
2018-Nov-09 19:44 UTC
[llvm-dev] [monorepo] Pre-push hook to prevent pushing merge commits
Roman Lebedev via llvm-dev <llvm-dev at lists.llvm.org> writes:> (I don't think you can have server-side hooks on github, so if that is required, > the master (as in, not a mirror, but the one you commit things into) > git monorepo can't be located on github..)This is the main reason we did not go with a GitHub solution for our code. If we used a pull request model for the monorepo then review can mitigate the kinds of problems that server-side hooks address, but of course it's a more manual process and prone to mistakes. I understand that a decision in that direction is orthogonal to moving to git. -David
Zachary Turner via llvm-dev
2018-Nov-10 02:36 UTC
[llvm-dev] [monorepo] Pre-push hook to prevent pushing merge commits
On Fri, Nov 9, 2018 at 11:41 AM Roman Lebedev via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On Fri, Nov 9, 2018 at 10:33 PM Louis Dionne via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > Hi, > > > > At the LLVM dev meeting, some people discussed the possibility of having > pre-push and/or pre-commit hooks to avoid messing up the history when we > move on to the monorepo. One of the concerns was about people starting to > push merge commits and unsquashed commits upstream, resulting in a messy > history. > > > > I had volunteered to write a hook that would check for the absence of > merge commits in the set of commits being pushed upstream, which I did. The > hook is available here: > https://gist.github.com/ldionne/2c260ce2081db74206e074e09cff71d0. > > > > If there is any interest for something like this, the code’s there. > I would like to note that it is a client-side hook. So every one would > need to install it. > To be actually able to prevent such things, it needs to be > centralized, server-side hook. > (I don't think you can have server-side hooks on github, so if that is > required, > the master (as in, not a mirror, but the one you commit things into) > git monorepo can't be located on github..) >Github has the notion of protected branches. This is the same way you disable the ability to force push to a branch, which I dare say is absolute mandatory that we enable for master, and probably every other branch as well, except for perhaps 1-2 admins. I haven't studied the API in detail, but I believe it should be possible to create a required check that a commit is not a merge commit (among other things), and reject it if it is. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181109/43918995/attachment.html>