Thanks for the nice script. I've just installed it :-)

On 21 Jan 2015, at 13:57, Max Michels <m...@data-artisans.com> wrote:

> I've created a pre-push hook that does what I described (and a bit
> more). It does only enforce a check for the remote flink master branch
> and doesn't disturb you on your pushes.
> 
> https://gist.github.com/mxm/4d1e26b901c66a682e4a
> 
> Just put the the file in the .git/hooks/ directory of your repository 
> directory.
> 
> For example, if you run git push origin, it will check the URL of
> origin to contain "git.apache.org/flink.git". If the remote branch is
> master, it will run the 'mvn clean package' and then fail to push if
> maven doesn't exit successfully.
> 
> Here some examples where I set protected_remote to my remote at
> "ssh://g...@github.com/mxm/flink.git" and protected_branch to "master":
> 
> 
> $ git push origin
> Verifying push to master via 'maven clean package'.
> ...
> Commits could not be verified. Executed 'mvn clean package' and it returned 1
> error: failed to push some refs to 'ssh://g...@github.com/mxm/flink.git'
> 
> 
> $ git push origin
> Verifying push to master via 'maven clean package'.
> ...
> Counting objects: 12, done.
> Delta compression using up to 8 threads.
> Compressing objects: 100% (8/8), done.
> Writing objects: 100% (12/12), 838 bytes | 0 bytes/s, done.
> Total 12 (delta 5), reused 0 (delta 0)
> To ssh://g...@github.com/mxm/flink.git
>   ce8acc4..d60197b  master -> master
> 
> 
> $ git checkout master
> $ git push origin other:master
> Please switch to branch "other" to verify.
> 
> 
> $ vim README # make some changes
> $ git push origin
> Please commit or stash your pending changes.
> 
> 
> Hope this comes in handy for you.
> 
> Best regards,
> Max
> 
> On Wed, Jan 21, 2015 at 1:46 PM, Max Michels <m...@data-artisans.com> wrote:
>> @Robert The pre-push hook only resides in your local repository. It
>> cannot be pushed. Thus, we cannot enforce this check but it certainly
>> helps to prevent mistakes. As Ufuk mentioned, you can then even skip
>> the check with the --no-verify option if you're really sure.
>> 
>> On Wed, Jan 21, 2015 at 11:45 AM, Ufuk Celebi <u...@apache.org> wrote:
>>> 
>>> On 21 Jan 2015, at 11:40, Robert Metzger <rmetz...@apache.org> wrote:
>>> 
>>>> Is the git hook something we can control for everybody? I thought its more
>>>> like a personal thing everybody can set up if wanted?
>>>> 
>>>> I'm against enforcing something like this for every committer. I don't want
>>>> to wait for 15 minutes for pushing a typo fix to the documentation.
>>> 
>>> Sorry, I didn't mean to have it in the repo. As long as we notice failing 
>>> builds fast enough (aka email notification), it should be OK to keep it 
>>> that way. As you said, every committer should decide this on her own. BTW 
>>> You can always skip hooks with git push -n (--no-verify).

Reply via email to