Examples of RevBlob


Examples of org.eclipse.jgit.revwalk.RevBlob

    assertEquals(id, db.resolve(reader.abbreviate(id, 8).name()));
  }

  @Test
  public void testAbbreviatePackedBlob() throws Exception {
    RevBlob id = test.blob("test");
    test.branch("master").commit().add("test", id).child();
    test.packAndPrune();
    assertTrue(reader.has(id));

    assertEquals(id.abbreviate(7), reader.abbreviate(id, 7));
    assertEquals(id.abbreviate(8), reader.abbreviate(id, 8));
    assertEquals(id.abbreviate(10), reader.abbreviate(id, 10));
    assertEquals(id.abbreviate(16), reader.abbreviate(id, 16));

    Collection<ObjectId> matches = reader.resolve(reader.abbreviate(id, 8));
    assertNotNull(matches);
    assertEquals(1, matches.size());
    assertEquals(id, matches.iterator().next());
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

import org.junit.Test;

public class GcPruneNonReferencedTest extends GcTestCase {
  @Test
  public void nonReferencedNonExpiredObject_notPruned() throws Exception {
    RevBlob a = tr.blob("a");
    gc.setExpire(new Date(lastModified(a)));
    gc.prune(Collections.<ObjectId> emptySet());
    assertTrue(repo.hasObject(a));
  }
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

    assertTrue(repo.hasObject(a));
  }

  @Test
  public void nonReferencedExpiredObject_pruned() throws Exception {
    RevBlob a = tr.blob("a");
    gc.setExpireAgeMillis(0);
    fsTick();
    gc.prune(Collections.<ObjectId> emptySet());
    assertFalse(repo.hasObject(a));
  }
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

    assertFalse(repo.hasObject(a));
  }

  @Test
  public void nonReferencedExpiredObjectTree_pruned() throws Exception {
    RevBlob a = tr.blob("a");
    RevTree t = tr.tree(tr.file("a", a));
    gc.setExpireAgeMillis(0);
    fsTick();
    gc.prune(Collections.<ObjectId> emptySet());
    assertFalse(repo.hasObject(t));
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

    assertFalse(repo.hasObject(a));
  }

  @Test
  public void nonReferencedObjects_onlyExpiredPruned() throws Exception {
    RevBlob a = tr.blob("a");
    gc.setExpire(new Date(lastModified(a) + 1));

    fsTick();
    RevBlob b = tr.blob("b");

    gc.prune(Collections.<ObjectId> emptySet());
    assertFalse(repo.hasObject(a));
    assertTrue(repo.hasObject(b));
  }
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_PATH,
        "sub");
    // Different config in the index should be overridden by the working tree.
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_URL,
        "git://example.com/bad");
    final RevBlob gitmodulesBlob = testDb.blob(gitmodules.toText());

    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_URL,
        "git://example.com/sub");
    writeTrashFile(DOT_GIT_MODULES, gitmodules.toText());
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

  }

  @Test
  public void testTinyThinPack() throws Exception {
    TestRepository d = new TestRepository<Repository>(db);
    RevBlob a = d.blob("a");

    TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024);

    packHeader(pack, 1);

    pack.write((Constants.OBJ_REF_DELTA) << 4 | 4);
    a.copyRawTo(pack);
    deflate(pack, new byte[] { 0x1, 0x1, 0x1, 'b' });

    digest(pack);

    PackParser p = index(new ByteArrayInputStream(pack.toByteArray()));
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

  }

  @Test
  public void testPackWithTrailingGarbage() throws Exception {
    TestRepository d = new TestRepository<Repository>(db);
    RevBlob a = d.blob("a");

    TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024);
    packHeader(pack, 1);
    pack.write((Constants.OBJ_REF_DELTA) << 4 | 4);
    a.copyRawTo(pack);
    deflate(pack, new byte[] { 0x1, 0x1, 0x1, 'b' });
    digest(pack);

    PackParser p = index(new UnionInputStream(
        new ByteArrayInputStream(pack.toByteArray()),
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

  }

  @Test
  public void testMaxObjectSizeDeltaBlock() throws Exception {
    TestRepository d = new TestRepository<Repository>(db);
    RevBlob a = d.blob("a");

    TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024);

    packHeader(pack, 1);
    pack.write((Constants.OBJ_REF_DELTA) << 4 | 14);
    a.copyRawTo(pack);
    deflate(pack, new byte[] { 1, 11, 11, 'a', '0', '1', '2', '3', '4',
        '5', '6', '7', '8', '9' });
    digest(pack);

    PackParser p = index(new ByteArrayInputStream(pack.toByteArray()));
View Full Code Here

Examples of org.eclipse.jgit.revwalk.RevBlob

  }

  @Test
  public void testMaxObjectSizeDeltaResultSize() throws Exception {
    TestRepository d = new TestRepository<Repository>(db);
    RevBlob a = d.blob("0123456789");

    TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024);

    packHeader(pack, 1);
    pack.write((Constants.OBJ_REF_DELTA) << 4 | 4);
    a.copyRawTo(pack);
    deflate(pack, new byte[] { 10, 11, 1, 'a' });
    digest(pack);

    PackParser p = index(new ByteArrayInputStream(pack.toByteArray()));
    p.setAllowThin(true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.