Remove wrong error message if pushing a new ref fails

If pushing a new ref is rejected because the user is not allowed to
create it the error message always told the user that he's missing the
'Create Reference' access right. This is not true in all cases, users
may have the 'Create Reference' access right assigned and still they
are not allowed to create the ref:
- pushing an annotated tag requires the 'Push Annotated Tag' access
  right
- pushing a signed tag requires the 'Push Signed Tag' access right
- the project state may be set to 'Read Only'

It is better to have a generic error message that is described in the
documentation than having a more concrete error message that is wrong
in some cases. A wrong error message misleads and confuses the user.

Updating the description of the 'Prohibited by Gerrit' error in the
documentation to explain some additional cases in which this error
occurs.

Bug: issue 1767
Change-Id: I45470256107198ae9208ccc375a6ec8d0c4f6e1d
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin 2013-01-23 09:08:40 +01:00
parent 0a3018492a
commit 8c0c02d399
2 changed files with 7 additions and 6 deletions

View File

@ -17,11 +17,15 @@ In particular this error occurs:
3. if you push an annotated tag without
link:access-control.html#category_push_annotated['Push Annotated Tag']
access right on 'refs/tags/*'
4. if you push a lightweight tag without the access right link:access-control.html#category_create['Create
4. if you push a signed tag without
link:access-control.html#category_push_signed['Push Signed Tag']
access right on 'refs/tags/*'
5. 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
6. 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/*'
7. if you push to a project that is in state 'Read Only'
For new users it often happens that they accidentally try to bypass
code review. The push then fails with the error message 'prohibited

View File

@ -154,9 +154,7 @@ public class ReceiveCommits {
+ "flag set to delete references."),
DELETE_CHANGES("Cannot delete from 'refs/changes'"),
CODE_REVIEW("You need 'Push' rights to upload code review requests.\n"
+ "Verify that you are pushing to the right branch."),
CREATE("You are not allowed to perform this operation.\n"
+ "To create new references you need 'Create Reference' rights.");
+ "Verify that you are pushing to the right branch.");
private final String value;
@ -883,7 +881,6 @@ public class ReceiveCommits {
validateNewCommits(ctl, cmd);
batch.addCommand(cmd);
} else {
errors.put(Error.CREATE, ctl.getRefName());
reject(cmd);
}
}