How do I allow merge commits without a "Bug nnn" reference past gitzilla's hooks

StackOverflow https://stackoverflow.com/questions/16547329

  •  29-05-2022
  •  | 
  •  

Question

I have Bugzilla and gitzilla set up as defined on the gitzilla home page (http://www.theoldmonk.net/gitzilla/) with the default post-receive and update hooks. When I push any commits with the appropriate "Bug nnn"-like regexes it works perfectly fine. The problem is that I have to mark all of my merge commits with a similar regex or it is rejected by the gitzilla hooks:

remote: ======================================================================
remote: Cannot accept commit.
remote: 
remote: No bug ref found in commit:

If I updated the merge commit to contain a reference to a bug in Bugzilla the push succeeds. Unfortunately, even though those merge commits are tagged with a bug reference, that bug in Bugzilla isn't updated by the commit.

So, I think there are two options for fixing my problem. The option I'd like to be able to do is change something in the hook so that I don't need a "Bug nnn" reference on any merge commits. If that's not do-able, the second best option would be to actually update the bug in Bugzilla named in the merge commit.

Était-ce utile?

La solution

You could add the --no-merges option to the hook here:

https://github.com/gera/gitzilla/blob/master/utils.py#L76

Change it to this:

asCommand = ['git', sCommand, "--no-merges",
             "--format=format:%s%s" % (sSeparator, sFormatSpec)]

As this is a utility function, it may also be used by others checks (don't know), so take that into account when changing it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top