From 6ae9b219325b65e0ba9e08567ea4078e7b6e52ea Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Tue, 21 Aug 2012 15:41:05 +0200 Subject: [PATCH] Fix message if pushing tag is rejected because tagger is somebody else Pushing a tag that has somebody else as tagger requires the 'Forge Committer' access right. If this access right is missing Gerrit currently rejects the push with "can not create new references". This error message is misleading because the user may think that the 'Create Reference' access right is missing which is actually assigned. The same reject message is also returned on push of an annotated tag if the 'Push Annotated Tag' access right is missing. Also in this case the error message is not ideal. Go back to the old more generic message which says 'prohibited by Gerrit'. This error message is at least explained in the Gerrit documentation so that the user can find out the reason. The new error message is not documented. Describe the missing case in the 'prohibited by Gerrit' error documentation if pushing a tag fails because the tagger is somebody else and the 'Forge Committer' access right is not assigned. Change-Id: Ib2e20bbc5f1c7d47e93fc0b2c5fecfa86908419e Signed-off-by: Edwin Kempin --- Documentation/error-prohibited-by-gerrit.txt | 3 +++ .../main/java/com/google/gerrit/server/git/ReceiveCommits.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/error-prohibited-by-gerrit.txt b/Documentation/error-prohibited-by-gerrit.txt index df46566034..56e585168e 100644 --- a/Documentation/error-prohibited-by-gerrit.txt +++ b/Documentation/error-prohibited-by-gerrit.txt @@ -19,6 +19,9 @@ In particular this error occurs: access right on 'refs/tags/*' 4. if you push a lightweight tag without the access right link:access-control.html#category_create['Create Reference'] for the reference name 'refs/tags/*' +5. if you push a tag with somebody else as tagger and you don't have the + link:access-control.html#category_forge_committer['Forge Committer'] + access right for the reference name 'refs/tags/*' For new users it often happens that they accidentally try to bypass code review. The push then fails with the error message 'prohibited diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java index ccf7c2dc14..6a6f908851 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java @@ -837,7 +837,7 @@ public class ReceiveCommits { batch.addCommand(cmd); } else { errors.put(Error.CREATE, ctl.getRefName()); - reject(cmd, "can not create new references"); + reject(cmd); } }