Package org.eclipse.jgit.storage.file

Examples of org.eclipse.jgit.storage.file.ObjectDirectory


    digest(pack);
    openPack(pack);

    // Verify the only storage of b is our packed delta above.
    //
    ObjectDirectory od = (ObjectDirectory) src.getObjectDatabase();
    assertTrue("has b", src.hasObject(b));
    assertFalse("b not loose", od.fileFor(b).exists());

    // Now use b but in a different commit than what is hidden.
    //
    TestRepository s = new TestRepository(src);
    RevCommit N = s.commit().parent(B).add("q", b).create();
View Full Code Here


   *
   * @throws Exception
   */
  public void packAndPrune() throws Exception {
    if (db.getObjectDatabase() instanceof ObjectDirectory) {
      ObjectDirectory odb = (ObjectDirectory) db.getObjectDatabase();
      NullProgressMonitor m = NullProgressMonitor.INSTANCE;

      final File pack, idx;
      PackWriter pw = new PackWriter(db);
      try {
        Set<ObjectId> all = new HashSet<ObjectId>();
        for (Ref r : db.getAllRefs().values())
          all.add(r.getObjectId());
        pw.preparePack(m, all, Collections.<ObjectId> emptySet());

        final ObjectId name = pw.computeName();
        OutputStream out;

        pack = nameFor(odb, name, ".pack");
        out = new BufferedOutputStream(new FileOutputStream(pack));
        try {
          pw.writePack(m, m, out);
        } finally {
          out.close();
        }
        pack.setReadOnly();

        idx = nameFor(odb, name, ".idx");
        out = new BufferedOutputStream(new FileOutputStream(idx));
        try {
          pw.writeIndex(out);
        } finally {
          out.close();
        }
        idx.setReadOnly();
      } finally {
        pw.release();
      }

      odb.openPack(pack, idx);
      updateServerInfo();
      prunePacked(odb);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.storage.file.ObjectDirectory

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.