Fix error message for rejecting a push to a change of another project

Users can still upload a new patch set by explicitly pushing a commit
to a change by specifying it as target ref. E.g.:
git push origin HEAD:refs/changes/711

If the specified change belongs to another project, Gerrit rejects
the push with the error message "change ... not found". This error
message is incorrect since the change actually exists in Gerrit.

This change now provides a better error message for this case:
"change ... does not belong to project ...".
In addition it adds a documentation page that explains this error.

Change-Id: I806acba774f8a1c6c0a6439e92314993f0ab4289
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2011-03-17 15:22:50 +01:00
parent 78ea8756d3
commit 3fc69ca36a
3 changed files with 18 additions and 1 deletions

View File

@@ -774,7 +774,7 @@ public class ReceiveCommits implements PreReceiveHook, PostReceiveHook {
return;
}
if (!project.getNameKey().equals(changeEnt.getProject())) {
reject(cmd, "change " + changeId + " not found");
reject(cmd, "change " + changeId + " does not belong to project " + project.getName());
return;
}