Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] Force a bugzilla in a gerrit commit

Am 01.09.2016 um 23:43 schrieb Wim Jongman:
Hi,

Is it possible to automatically reject a Gerrit change when there is no associated valid bugzilla in the first line of the commit message?
I use this Ant target in my build script:

  <!-- ==================== -->
  <!-- Check Commit Message -->
  <!-- ==================== -->

  <target name="check.commit.msg" if="GERRIT_CHANGE_SUBJECT">
      <condition property="commit.msg.ok" value="true">
          <matches pattern="^\[[1-9][0-9]*\] .*$" string="${GERRIT_CHANGE_SUBJECT}"/>
      </condition>
      <fail message="The commit message is not of the form '[bug-id] bug-subject'." unless="commit.msg.ok"/>
  </target>

It doesn't actually check for a *valid* bug id, just for the correct syntax of the commit message.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper





Back to the top