@Override public ReceivePack create(DaemonClient req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { ReceivePack rp = new ReceivePack(db); InetAddress peer = req.getRemoteAddress(); String host = peer.getCanonicalHostName(); if (host == null) host = peer.getHostAddress(); String name = "anonymous"; //$NON-NLS-1$ String email = name + "@" + host; //$NON-NLS-1$ rp.setRefLogIdent(new PersonIdent(name, email)); rp.setTimeout(getTimeout()); return rp; } };
try { final ReceivePack rp = receivePackFactory.create(req, remote); rp.receive(out_r, in_w, System.err); } catch (ServiceNotEnabledException e) {
private void autoGc() { Repository repo = getRepository(); if (!repo.getConfig().getBoolean(ConfigConstants.CONFIG_RECEIVE_SECTION, ConfigConstants.CONFIG_KEY_AUTOGC, true)) { return; } repo.autoGC(NullProgressMonitor.INSTANCE); }
private void service() throws IOException { if (isBiDirectionalPipe()) { sendAdvertisedRefs(new PacketLineOutRefAdvertiser(pckOut)); pckOut.flush(); } else getAdvertisedOrDefaultRefs(); if (hasError()) return; recvCommands(); if (hasCommands()) { Throwable unpackError = null; if (needPack()) { try { receivePackAndCheckConnectivity(); } catch (IOException | RuntimeException | Error err) { unpackError = err; boolean atomic = isCapabilityEnabled(CAPABILITY_ATOMIC); setAtomic(atomic); validateCommands(); if (atomic && anyRejects()) { failPendingCommands(); this, filterCommands(Result.NOT_ATTEMPTED)); if (atomic && anyRejects()) { failPendingCommands(); executeCommands();
Proposal proposal = new Proposal(rp.getRevWalk(), cmds) .setPushCertificate(rp.getPushCertificate()) .setAuthor(rp.getRefLogIdent()) .setMessage("push"); //$NON-NLS-1$ leader.queueProposal(proposal); rp.getMessageOutputStream()); if (proposal.getState() == QUEUED) { waitForQueue(proposal, spinner);
@Override protected void runImpl() throws IOException, Failure { final ReceivePack rp = new ReceivePack(repo); rp.setRefLogIdent(currentUser.newRefLogIdent()); rp.setTimeout(config.getTimeout()); try { rp.receive(in, out, err); } catch (InterruptedIOException err) { throw new Failure(128, "fatal: client IO read/write timeout", err); } catch (UnpackException badStream) { // This may have been triggered by branch level access controls. // Log what the heck is going on, as detailed as we can. // StringBuilder msg = new StringBuilder(); msg.append("Unpack error on project \"" + projectName() + "\":\n"); msg.append("\n"); IOException detail = new IOException(msg.toString(), badStream); throw new Failure(128, "fatal: Unpack error, check server log", detail); } }
public ReceiveCommits(UserProfile user, UserExtension extension, Repository repository, SpeakeasyService speakeasyService, GitRepositoryManager gitRepositoryManager) { this.user = user; this.extension = extension; this.repository = repository; this.speakeasyService = speakeasyService; this.gitRepositoryManager = gitRepositoryManager; this.rp = new ReceivePack(repository); final String email = user.getEmail(); final String name = user.getFullName(); rp.setRefLogIdent(new PersonIdent(name, email)); rp.setPreReceiveHook(this); rp.setPostReceiveHook(this); }
private static ReceivePack createFor(final HttpServletRequest req, final Repository db, final String user) { final ReceivePack rp = new ReceivePack(db); rp.setRefLogIdent(toPersonIdent(req, user)); return rp; }
/** * Method description * * * @param dst * * @return */ @Override ReceivePack createReceivePack(Repository dst) { ReceivePack pack = new ReceivePack(dst); if ((hookEventFacade != null) && (handler != null)) { GitReceiveHook hook = new GitReceiveHook(hookEventFacade, handler); pack.setPreReceiveHook(hook); pack.setPostReceiveHook(hook); } return pack; }
rp.setRefLogIdent(new PersonIdent("system", "system", new Date(1L), TimeZone.getDefault())); rp.setTimeout(getTimeout()); rp.setPreReceiveHook((rp12, commands) -> System.out.println("[" + addr.getHostString() + "]" + " onPreReceive!")); rp.setPostReceiveHook((rp1, commands) -> System.out.println("[" + addr.getHostString() + "]" + " onPostReceive!")); err); rp.setPreReceiveHook(new KetchPreReceive(leader)); return rp; };
@Override protected void run() throws Exception { final org.eclipse.jgit.transport.ReceivePack rp; try { FileKey key = FileKey.lenient(dstGitdir, FS.DETECTED); db = key.open(true /* must exist */); } catch (RepositoryNotFoundException notFound) { throw die(MessageFormat.format(CLIText.get().notAGitRepository, dstGitdir.getPath())); } rp = new org.eclipse.jgit.transport.ReceivePack(db); rp.receive(ins, outs, errs); } }
ReceivePack createReceivePack(Repository db) { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); ReceivePack rp = new ReceivePack(db); rp.setPostReceiveHook(new GitPostReceiveHook()); return rp; }
rp.setBiDirectionalPipe(false); rp.setEchoCommandFailures(hasPushStatusBug(version)); rsp.setContentType(RECEIVE_PACK_RESULT_TYPE); rp.receive(getInputStream(req), out, null); out.close(); } catch (CorruptObjectException e ) { HttpServerText.get().receivedCorruptObject, e.getMessage(), ServletUtils.identify(rp.getRepository()))); consumeRequestBody(req); out.close(); log(rp.getRepository(), e.getCause()); consumeRequestBody(req); out.close(); log(rp.getRepository(), e); if (!rsp.isCommitted()) { rsp.reset();
ReceivePack createReceivePack(Repository dst) { return new ReceivePack(dst); }
(Credential) httpServletRequest.getAttribute( Oauth2Filter.ATTRIBUTE_KEY)); ReceivePack receivePack = new ReceivePack(repository); String hostname = Util.getPostbackURL(); if (hostname == null) { hostname = httpServletRequest.getLocalName(); receivePack.setPreReceiveHook( new WriteLatexPutHook(repoStore, bridge, hostname, oauth2) );
@Override protected void execute(final FileSystemUser user, final Repository repository, final InputStream in, final OutputStream out, final OutputStream err, final JGitFileSystem fileSystem) { try { final ReceivePack rp = receivePackFactory.create(this, repository); rp.receive(in, out, err); rp.setPostReceiveHook((rp1, commands) -> { fileSystem.getGit().gc(); fileSystem.resetCommitCount(); }); } catch (final Exception ignored) { } } }
@Override protected void advertise(HttpServletRequest req, PacketLineOutRefAdvertiser pck) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { ReceivePack rp = (ReceivePack) req.getAttribute(ATTRIBUTE_HANDLER); try { rp.sendAdvertisedRefs(pck); } finally { rp.getRevWalk().close(); } } }
rp.setBiDirectionalPipe(false); rp.setEchoCommandFailures(hasPushStatusBug(version)); rsp.setContentType(RECEIVE_PACK_RESULT_TYPE); rp.receive(getInputStream(req), out, null); out.close(); } catch (UnpackException e) {
org.eclipse.jgit.lib.Repository repository = rpack.getRepository(); walk = rpack.getRevWalk(); converter = new GitChangesetConverter(repository, walk);
@Override public ReceivePack create(HttpServletRequest request, Repository repository) throws ServiceNotEnabledException, ServiceNotAuthorizedException { ReceivePack receivePack = wrapped.create(request, repository); receivePack.setAllowNonFastForwards(isNonFastForwardAllowed()); receivePack.setPreReceiveHook(hook); receivePack.setPostReceiveHook(hook); // apply collecting listener, to be able to check which commits are new CollectingPackParserListener.set(receivePack); return receivePack; }