Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.ReceivePack


            RepositoryCache.FileKey key = RepositoryCache.FileKey.lenient(srcGitdir, FS.DETECTED);
            Repository db = key.open(true /* must exist */);
            if ("git-upload-pack".equals(args[0])) {
                new UploadPack(db).upload(in, out, err);
            } else if ("git-receive-pack".equals(args[0])) {
                new ReceivePack(db).receive(in, out, err);
            } else {
                throw new IllegalArgumentException("Unknown git command: " + command);
            }
        } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here


        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);
View Full Code Here

    this.requestScopePropagator = requestScopePropagator;

    this.projectControl = projectControl;
    this.project = projectControl.getProject();
    this.repo = repo;
    this.rp = new ReceivePack(repo);
    this.rejectCommits = loadRejectCommitsMap();

    this.subOpFactory = subOpFactory;

    this.messageSender = new ReceivePackMessageSender();
View Full Code Here

        FilterChain chain) throws IOException, ServletException {
      boolean isGet =
        "GET".equalsIgnoreCase(((HttpServletRequest) request).getMethod());

      ReceiveCommits rc = (ReceiveCommits) request.getAttribute(ATT_RC);
      ReceivePack rp = rc.getReceivePack();
      ProjectControl pc = (ProjectControl) request.getAttribute(ATT_CONTROL);
      Project.NameKey projectName = pc.getProject().getNameKey();

      if (!pc.canRunReceivePack()) {
        GitSmartHttpTools.sendError((HttpServletRequest) request,
            (HttpServletResponse) response, HttpServletResponse.SC_FORBIDDEN,
            "receive-pack not permitted on this server");
        return;
      }

      final Capable s = rc.canUpload();
      if (s != Capable.OK) {
        GitSmartHttpTools.sendError((HttpServletRequest) request,
            (HttpServletResponse) response, HttpServletResponse.SC_FORBIDDEN,
            "\n" + s.getMessage());
        return;
      }

      if (!rp.isCheckReferencedObjectsAreReachable()) {
        if (isGet) {
          rc.advertiseHistory();
        }
        chain.doFilter(request, response);
        return;
      }

      if (!(pc.getCurrentUser() instanceof IdentifiedUser)) {
        chain.doFilter(request, response);
        return;
      }

      AdvertisedObjectsCacheKey cacheKey = new AdvertisedObjectsCacheKey(
          ((IdentifiedUser) pc.getCurrentUser()).getAccountId(),
          projectName);

      if (isGet) {
        rc.advertiseHistory();
        cache.invalidate(cacheKey);
      } else {
        Set<ObjectId> ids = cache.getIfPresent(cacheKey);
        if (ids != null) {
          rp.getAdvertisedObjects().addAll(ids);
          cache.invalidate(cacheKey);
        }
      }

      chain.doFilter(request, response);

      if (isGet) {
        cache.put(cacheKey, Collections.unmodifiableSet(
            new HashSet<ObjectId>(rp.getAdvertisedObjects())));
      }
    }
View Full Code Here

      HttpServletResponse res, String textForGit) throws IOException {
    ByteArrayOutputStream buf = new ByteArrayOutputStream(128);
    PacketLineOut pckOut = new PacketLineOut(buf);

    boolean sideband;
    ReceivePack rp = (ReceivePack) req.getAttribute(ATTRIBUTE_HANDLER);
    if (rp != null) {
      try {
        sideband = rp.isSideBand();
      } catch (RequestNotYetReadException e) {
        sideband = isReceivePackSideBand(req);
      }
    } else
      sideband = isReceivePackSideBand(req);
View Full Code Here

      public void flush() throws IOException {
        doFlush();
      }
    };

    ReceivePack rp = (ReceivePack) req.getAttribute(ATTRIBUTE_HANDLER);
    try {
      rp.setBiDirectionalPipe(false);
      rp.setEchoCommandFailures(hasPushStatusBug(version));
      rsp.setContentType(RECEIVE_PACK_RESULT_TYPE);

      rp.receive(getInputStream(req), out, null);
      out.close();
    } catch (UnpackException e) {
      // This should be already reported to the client.
      getServletContext().log(
          HttpServerText.get().internalErrorDuringReceivePack,
View Full Code Here

    @Override
    protected void begin(HttpServletRequest req, Repository db)
        throws IOException, ServiceNotEnabledException,
        ServiceNotAuthorizedException {
      ReceivePack rp = receivePackFactory.create(req, db);
      req.setAttribute(ATTRIBUTE_HANDLER, rp);
    }
View Full Code Here

    @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().release();
      }
    }
View Full Code Here

    public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain) throws IOException, ServletException {
      HttpServletRequest req = (HttpServletRequest) request;
      HttpServletResponse rsp = (HttpServletResponse) response;
      ReceivePack rp;
      try {
        rp = receivePackFactory.create(req, getRepository(req));
      } catch (ServiceNotAuthorizedException e) {
        rsp.sendError(SC_UNAUTHORIZED);
        return;
View Full Code Here

    throw new ServiceNotAuthorizedException();
  }

  private ReceivePack createFor(final HttpServletRequest req,
      final Repository db, final String user) {
    final ReceivePack rp = new ReceivePack(db);
    rp.setRefLogIdent(toPersonIdent(req, user));
    return rp;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.transport.ReceivePack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.