Reputation: 143
I'm trying to get the submitter email which merged a patch in gerrit.
I have the hash id of the commit, which I can use to know the change-id of the change. if I'm using:
git show --pretty="format:%ce"
I'm getting the user gerrit2 which is probably the gerrit username which used to merge the patch to the git repo. any help will be appreciated, thx
Upvotes: 0
Views: 203
Reputation: 744
That line should work if you want the email of the commit's owner.
If however you're looking for the email address of the user who submitted the patch, that gets rather tricky since it's not recorded anywhere accessible from git. You would need to use the Gerrit Command Line Tools to run a query and parse the output.
Here's an example:
$ ssh -p 29418 review.example.com gerrit query --current-patch-set 9eb67bd
The value you're looking for in the output is "change > currentPatchSet > uploader > email".
The output isn't terribly easy to parse though, perhaps you could add the --format=json option and pipe it to Python to use its JSON module.
Upvotes: 1