List of usage examples for org.eclipse.jgit.transport UploadPack setPackConfig
public void setPackConfig(@Nullable PackConfig pc)
From source file:com.google.gerrit.sshd.commands.Upload.java
License:Apache License
@Override protected void runImpl() throws IOException, Failure { if (!projectControl.canRunUploadPack()) { throw new Failure(1, "fatal: upload-pack not permitted on this server"); }/*from w ww .j av a 2 s . c o m*/ final UploadPack up = new UploadPack(repo); if (!projectControl.allRefsAreVisible()) { up.setAdvertiseRefsHook( new VisibleRefFilter(tagCache, changeCache, repo, projectControl, db.get(), true)); } up.setPackConfig(config.getPackConfig()); up.setTimeout(config.getTimeout()); List<PreUploadHook> allPreUploadHooks = Lists.newArrayList(preUploadHooks); allPreUploadHooks.add(uploadValidatorsFactory.create(project, repo, session.getRemoteAddressAsString())); up.setPreUploadHook(PreUploadHookChain.newChain(allPreUploadHooks)); try { up.upload(in, out, err); } catch (UploadValidationException e) { // UploadValidationException is used by the UploadValidators to // stop the uploadPack. We do not want this exception to go beyond this // point otherwise it would print a stacktrace in the logs and return an // internal server error to the client. if (!e.isOutput()) { up.sendMessage(e.getMessage()); } } }
From source file:net.antoniy.gidder.beta.ssh.Upload.java
License:Apache License
@Override protected void runImpl() throws IOException { if (!hasPermission()) { err.write(MSG_REPOSITORY_PERMISSIONS.getBytes()); err.flush();/*from www . j av a2s . c o m*/ onExit(CODE_OK, MSG_REPOSITORY_PERMISSIONS); return; } Config config = new Config(); // int timeout = Integer.parseInt(config.getString("transfer", null, // "timeout")); int timeout = 10; PackConfig packConfig = new PackConfig(); packConfig.setDeltaCompress(false); packConfig.setThreads(1); packConfig.fromConfig(config); final UploadPack up = new UploadPack(repo); up.setPackConfig(packConfig); up.setTimeout(timeout); up.upload(in, out, err); }