Re: [Spacewalk-devel] Re: Proposed commit hook to catch suspicious merge commits

2009-05-15 Thread Jan Pazdziora
On Tue, May 12, 2009 at 03:25:53PM +0200, Jan Pazdziora wrote:
> > 
> > Jan, is there something I can do to edit that message and get this push
> > to work?
> 
> The one of d1c65b572d1b9e1ccd863cce3104a853acc9ad9f? Nope. The best
> bet will probably be to ask the infrastructure guys to disable the
> hook, do the push, and enable it again. Upon subsequent pushes, the
> commit will already not be considered by the hook.

I was thinking about this more.

Can't you merge the commit just before the merge commit which causes
a trouble, then cherry pick that commit's change with normal commit,
and then merge the HEAD? That way, the git rev-list could be reporting
the new non-merge commit, not the merge one.

Could you give it a try?

-- 
Jan Pazdziora
Senior Software Engineer, Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


[Spacewalk-devel] Re: Proposed commit hook to catch suspicious merge commits

2009-05-12 Thread Jan Pazdziora
On Tue, May 12, 2009 at 09:32:18AM -0300, Devan Goodwin wrote:
> 
> > On Thu, Mar 12, 2009 at 09:33:44AM -0300, Devan Goodwin wrote:
> > > 
> > > Works for me. Yeah I'd be in favor of the commit hook.
> > 
> > My first attempt at the hook which would catch commits that seems to
> > be automatic merges done during git pull is in the attachment.
> > 
> 
> I did a merge master to pgsql merge yesterday, I used the default
> commit msg at first and this was rejected by your script. I did a git
> commit --amend and changed the message to not match the regex: 
> 
> if ($msg =~ /^Merge branch \S+ of \S+\n*$/s) {
> }
> 
> But I still get:
> 
> $ git push origin pgsql
> Counting objects: 204, done.
> Compressing objects: 100% (68/68), done.
> Writing objects: 100% (74/74), 8.92 KiB, done.
> Total 74 (delta 61), reused 0 (delta 0)
> Commit [d1c65b572d1b9e1ccd863cce3104a853acc9ad9f] looks like automatic
> merge when you did not rebase after pull.
> To ssh://dgood...@git.fedorahosted.org/git/spacewalk.git
> error: hooks/pre-receive exited with error code 1
>  ! [remote rejected] pgsql -> pgsql (pre-receive hook declined)
> error: failed to push some refs to
> 'ssh://dgood...@git.fedorahosted.org/git/spacewalk.git'
> 
> The commit it's complaining about is not my most recent:

The hook checks all commits that are being "added" to the ref since
you can do multiple commits (and multiple merge commits) with one
push.

> $ git show d1c65b572d1b9e1ccd863cce3104a853acc9ad9f
> commit d1c65b572d1b9e1ccd863cce3104a853acc9ad9f
> Merge: ef29cde... 1e0d837...
> Author: Jan Pazdziora 
> Date:   Tue Apr 21 10:39:27 2009 +0200
> 
> Merge branch 'master' of ssh://git.fedorahosted.org/git/spacewalk
> 
> 
> Jan, is there something I can do to edit that message and get this push
> to work?

The one of d1c65b572d1b9e1ccd863cce3104a853acc9ad9f? Nope. The best
bet will probably be to ask the infrastructure guys to disable the
hook, do the push, and enable it again. Upon subsequent pushes, the
commit will already not be considered by the hook.

-- 
Jan Pazdziora
Senior Software Engineer, Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


[Spacewalk-devel] Re: Proposed commit hook to catch suspicious merge commits

2009-05-12 Thread Devan Goodwin
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, 2 Apr 2009 10:54:21 +0200
Jan Pazdziora  wrote:

> On Thu, Mar 12, 2009 at 09:33:44AM -0300, Devan Goodwin wrote:
> > 
> > Works for me. Yeah I'd be in favor of the commit hook.
> 
> My first attempt at the hook which would catch commits that seems to
> be automatic merges done during git pull is in the attachment.
> 

I did a merge master to pgsql merge yesterday, I used the default
commit msg at first and this was rejected by your script. I did a git
commit --amend and changed the message to not match the regex: 

if ($msg =~ /^Merge branch \S+ of \S+\n*$/s) {
}

But I still get:

$ git push origin pgsql
Counting objects: 204, done.
Compressing objects: 100% (68/68), done.
Writing objects: 100% (74/74), 8.92 KiB, done.
Total 74 (delta 61), reused 0 (delta 0)
Commit [d1c65b572d1b9e1ccd863cce3104a853acc9ad9f] looks like automatic
merge when you did not rebase after pull.
To ssh://dgood...@git.fedorahosted.org/git/spacewalk.git
error: hooks/pre-receive exited with error code 1
 ! [remote rejected] pgsql -> pgsql (pre-receive hook declined)
error: failed to push some refs to
'ssh://dgood...@git.fedorahosted.org/git/spacewalk.git'

The commit it's complaining about is not my most recent:

$ git show d1c65b572d1b9e1ccd863cce3104a853acc9ad9f
commit d1c65b572d1b9e1ccd863cce3104a853acc9ad9f
Merge: ef29cde... 1e0d837...
Author: Jan Pazdziora 
Date:   Tue Apr 21 10:39:27 2009 +0200

Merge branch 'master' of ssh://git.fedorahosted.org/git/spacewalk


Jan, is there something I can do to edit that message and get this push
to work?

Devan





- -- 
  Devan Goodwin 
  Software Engineer Spacewalk / RHN Satellite
  Halifax, Canada   650.567.9039x79267
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (GNU/Linux)

iEYEARECAAYFAkoJbFYACgkQAyHWaPV9my6vuQCg5tqxUh7i5yU1B/HZvSoA63iP
3v8AoOjm7VdubbEbr5RKBEyWNlQnCgJA
=UVe5
-END PGP SIGNATURE-

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel