Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.RefAdvertiser


    rsp.setCharacterEncoding(Constants.CHARACTER_ENCODING);

    final Repository db = getRepository(req);
    final OutputStreamWriter out = new OutputStreamWriter(
        new SmartOutputStream(req, rsp), Constants.CHARSET);
    final RefAdvertiser adv = new RefAdvertiser() {
      @Override
      protected void writeOne(final CharSequence line) throws IOException {
        // Whoever decided that info/refs should use a different
        // delimiter than the native git:// protocol shouldn't
        // be allowed to design this sort of stuff. :-(
        out.append(line.toString().replace(' ', '\t'));
      }

      @Override
      protected void end() {
        // No end marker required for info/refs format.
      }
    };
    adv.init(db);
    adv.setDerefTags(true);

    Map<String, Ref> refs = db.getAllRefs();
    refs.remove(Constants.HEAD);
    adv.send(refs);
    out.close();
  }
View Full Code Here


    final Repository db = getRepository(req);
    final OutputStreamWriter out = new OutputStreamWriter(
        new SmartOutputStream(req, rsp, true),
        Constants.CHARSET);
    final RefAdvertiser adv = new RefAdvertiser() {
      @Override
      protected void writeOne(final CharSequence line) throws IOException {
        // Whoever decided that info/refs should use a different
        // delimiter than the native git:// protocol shouldn't
        // be allowed to design this sort of stuff. :-(
        out.append(line.toString().replace(' ', '\t'));
      }

      @Override
      protected void end() {
        // No end marker required for info/refs format.
      }
    };
    adv.init(db);
    adv.setDerefTags(true);

    Map<String, Ref> refs = db.getRefDatabase().getRefs(ALL);
    refs.remove(Constants.HEAD);
    adv.send(refs);
    out.close();
  }
View Full Code Here

    try {
      final RevFlag ADVERTISED = walk.newFlag("ADVERTISED");

      final OutputStreamWriter out = new OutputStreamWriter(
          new SmartOutputStream(req, rsp), Constants.CHARSET);
      final RefAdvertiser adv = new RefAdvertiser() {
        @Override
        protected void writeOne(final CharSequence line)
            throws IOException {
          // Whoever decided that info/refs should use a different
          // delimiter than the native git:// protocol shouldn't
          // be allowed to design this sort of stuff. :-(
          out.append(line.toString().replace(' ', '\t'));
        }

        @Override
        protected void end() {
          // No end marker required for info/refs format.
        }
      };
      adv.init(walk, ADVERTISED);
      adv.setDerefTags(true);

      Map<String, Ref> refs = db.getAllRefs();
      refs.remove(Constants.HEAD);
      adv.send(refs);
      out.close();
    } finally {
      walk.release();
    }
  }
View Full Code Here

    final Repository db = getRepository(req);
    final OutputStreamWriter out = new OutputStreamWriter(
        new SmartOutputStream(req, rsp, true),
        Constants.CHARSET);
    final RefAdvertiser adv = new RefAdvertiser() {
      @Override
      protected void writeOne(final CharSequence line) throws IOException {
        // Whoever decided that info/refs should use a different
        // delimiter than the native git:// protocol shouldn't
        // be allowed to design this sort of stuff. :-(
        out.append(line.toString().replace(' ', '\t'));
      }

      @Override
      protected void end() {
        // No end marker required for info/refs format.
      }
    };
    adv.init(db);
    adv.setDerefTags(true);

    Map<String, Ref> refs = db.getAllRefs();
    refs.remove(Constants.HEAD);
    adv.send(refs);
    out.close();
  }
View Full Code Here

TOP

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

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.