Package com.google.gerrit.server.git
Class BanCommit
- java.lang.Object
-
- com.google.gerrit.server.git.BanCommit
-
public class BanCommit extends Object
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BanCommitResult
ban(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 Detail
-
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.
-
-