Package com.google.gerrit.server.git
Class BanCommit
java.lang.Object
com.google.gerrit.server.git.BanCommit
Logic for banning commits from being uploaded.
Gerrit has a per-project list of commits that are forbidden to be pushed. This class reads and
writes the banned commits list in refs/meta/reject-commits
.
-
Method Summary
Modifier and TypeMethodDescriptionban
(Project.NameKey project, CurrentUser user, List<org.eclipse.jgit.lib.ObjectId> commitsToBan, String reason) Bans a list of commits from the given project.static org.eclipse.jgit.notes.NoteMap
loadRejectCommitsMap
(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk walk) Loads a list of commits to reject fromrefs/meta/reject-commits
.
-
Method Details
-
loadRejectCommitsMap
public static org.eclipse.jgit.notes.NoteMap loadRejectCommitsMap(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk walk) throws IOException Loads a list of commits to reject fromrefs/meta/reject-commits
.- Parameters:
repo
- repository from which the rejected commits should be loadedwalk
- open revwalk on repo.- Returns:
- NoteMap of commits to be rejected, null if there are none.
- Throws:
IOException
- the map cannot be loaded.
-
ban
public BanCommitResult ban(Project.NameKey project, CurrentUser user, List<org.eclipse.jgit.lib.ObjectId> commitsToBan, String reason) throws AuthException, IOException, PermissionBackendException Bans a list of commits from the given project.The user must be specified, so it can be checked for the
BAN_COMMIT
permission.
-