Search code examples
gitgerrit

Modify commit message on gerrit after patchset creation?


I am trying to add the URL, for example (https://gerrit-server/#/c/7456/) into the commit message appearing on gerrit.

What I have tried so far is create a file patchset-created under gerrit_site/hooks/ which is launched when I push a change.

The problem is that I can't locate the commit message file, so I can modify its content.

I figured since I am trying to insert the URL into the commit message, I can't do this by using a hook on my local git repository because there is no way to know what URL it is going to be associated to on gerrit, so I thought it may be done by using a hook on gerrit side.

Would appreciate any feedback.


Solution

  • Alright so one way to do this is to change the project submit type to cherry pick and install the reviewnotes plugin for gerrit.

    Doing so will automatically Modify the Commit message (after you get Code review+2 and verified+1) adding Review-Id, Reviewed-on(URL), Reviewed-by and Tested-by labels.

    No need to use hooks.