Reputation: 448
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.
Upvotes: 6
Views: 18633
Reputation: 448
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.
Upvotes: 1
Reputation: 461
You can modifiy the commit message from gerrit UI directly. Just open the commit message on gerrit and click on the edit button next to patch-sets on the above. Do any change and then save it. You will need to submit you new commit message afterwards, appearing just above the owner section on the commit page.
Upvotes: 8
Reputation: 22341
There's no commit message file, actually you need to amend the original commit (using the "--commit " patchset-created parameter) to create a new one (patchset 2) with the new commit message.
In my opinion, It's not a good idea to amend all pushed commits automatically in the server. This procedure which will create two patchsets for each change (1. the original change 2. the change with the new commit message). This may confuse the users specially when they need to correct their changes.
I'm not sure if I did myself clear... please, let me know.
Why do you need to have the https://GERRIT-SERVER/#/c/xxxxx link in the commit message? It's very easy to find a change just putting the commit-id or change-id in the Gerrit search field...
Upvotes: 0