List of usage examples for org.eclipse.jgit.transport ReceivePack sendMessage
public void sendMessage(String what)
From source file:com.google.gerrit.gpg.SignedPushPreReceiveHook.java
License:Apache License
@Override public void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands) { PushCertificate cert = rp.getPushCertificate(); if (cert == null) { return;/*w ww. j av a 2 s. c o m*/ } PushCertificateChecker checker = new PushCertificateChecker(keyChecker) { @Override protected Repository getRepository() throws IOException { return repoManager.openRepository(allUsers); } @Override protected boolean shouldClose(Repository repo) { return true; } }; CheckResult result = checker.check(cert); if (!result.isOk()) { for (String problem : result.getProblems()) { rp.sendMessage(problem); } reject(commands, "invalid push cert"); } }
From source file:com.google.gerrit.server.git.gpg.SignedPushPreReceiveHook.java
License:Apache License
@Override public void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands) { try {// w ww . j a v a 2s.co m PushCertificate cert = rp.getPushCertificate(); if (cert == null) { return; } PushCertificateChecker checker = new PushCertificateChecker(new PublicKeyChecker()) { @Override protected Repository getRepository() throws IOException { return repoManager.openRepository(allUsers); } @Override protected boolean shouldClose(Repository repo) { return true; } }; CheckResult result = checker.check(cert); if (!result.isOk()) { for (String problem : result.getProblems()) { rp.sendMessage(problem); } reject(commands, "invalid push cert"); } } catch (PGPException | IOException e) { log.error("Error checking push certificate", e); reject(commands, "push cert error"); } }