Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.RefUpdate.update()


  @Test
  public void testNewNamespaceConflictWithPackedPrefixOfExisting()
      throws IOException {
    final String newRef = "refs/heads/prefix";
    final RefUpdate ru = updateRef(newRef);
    Result update = ru.update();
    assertEquals(Result.LOCK_FAILURE, update);
    assertNull(db.getReflogReader("refs/heads/prefix"));
    assertEquals(0, db.getReflogReader("HEAD").getReverseEntries().size());
  }
View Full Code Here


  public void testDeleteHEADreferencedRef() throws IOException {
    ObjectId pid = db.resolve("refs/heads/master^");
    RefUpdate updateRef = db.updateRef("refs/heads/master");
    updateRef.setNewObjectId(pid);
    updateRef.setForceUpdate(true);
    Result update = updateRef.update();
    assertEquals(Result.FORCED, update); // internal

    RefUpdate updateRef2 = db.updateRef("refs/heads/master");
    Result delete = updateRef2.delete();
    assertEquals(Result.REJECTED_CURRENT_BRANCH, delete);
View Full Code Here

  @Test
  public void testLooseDelete() throws IOException {
    final String newRef = "refs/heads/abc";
    RefUpdate ref = updateRef(newRef);
    ref.update(); // create loose ref
    ref = updateRef(newRef); // refresh
    delete(ref, Result.NO_CHANGE);
    assertNull(db.getReflogReader("refs/heads/abc"));
  }
View Full Code Here

    ObjectId pid = db.resolve("refs/heads/c^");
    RefUpdate updateRef = db.updateRef("refs/heads/z/c");
    updateRef.setNewObjectId(pid);
    updateRef.setForceUpdate(true);
    updateRef.setRefLogMessage("new test ref", false);
    Result update = updateRef.update();
    assertEquals(Result.NEW, update); // internal
    assertTrue(new File(db.getDirectory(), Constants.R_HEADS + "z")
        .exists());
    assertTrue(new File(db.getDirectory(), "logs/refs/heads/z").exists());
View Full Code Here

  public void testDeleteWithoutHead() throws IOException {
    // Prepare repository without HEAD
    RefUpdate refUpdate = db.updateRef(Constants.HEAD, true);
    refUpdate.setForceUpdate(true);
    refUpdate.setNewObjectId(ObjectId.zeroId());
    Result updateResult = refUpdate.update();
    assertEquals(Result.FORCED, updateResult);
    Result deleteHeadResult = db.updateRef(Constants.HEAD).delete();
    assertEquals(Result.NO_CHANGE, deleteHeadResult);

    // Any result is ok as long as it's not an NPE
View Full Code Here

    ObjectId pid = db.resolve("refs/heads/master");

    RefUpdate updateRef = db.updateRef("refs/heads/master");
    updateRef.setNewObjectId(ppid);
    updateRef.setForceUpdate(true);
    Result update = updateRef.update();
    assertEquals(Result.FORCED, update);
    assertEquals(ppid, db.resolve("refs/heads/master"));

    // real test
    RefUpdate updateRef2 = db.updateRef("refs/heads/master");
View Full Code Here

    assertEquals(ppid, db.resolve("refs/heads/master"));

    // real test
    RefUpdate updateRef2 = db.updateRef("refs/heads/master");
    updateRef2.setNewObjectId(pid);
    Result update2 = updateRef2.update();
    assertEquals(Result.FAST_FORWARD, update2);
    assertEquals(pid, db.resolve("refs/heads/master"));
  }

  /**
 
View Full Code Here

    ObjectId pid = db.resolve("refs/heads/master");
    ObjectId ppid = db.resolve("refs/heads/master^");
    RefUpdate updateRef = db.updateRef("HEAD", true);
    updateRef.setForceUpdate(true);
    updateRef.setNewObjectId(ppid);
    Result update = updateRef.update();
    assertEquals(Result.FORCED, update);
    assertEquals(ppid, db.resolve("HEAD"));
    Ref ref = db.getRef("HEAD");
    assertEquals("HEAD", ref.getName());
    assertTrue("is detached", !ref.isSymbolic());
View Full Code Here

    ObjectId ppid = db.resolve("refs/heads/master^");
    writeSymref("HEAD", "refs/heads/unborn");
    RefUpdate updateRef = db.updateRef("HEAD", true);
    updateRef.setForceUpdate(true);
    updateRef.setNewObjectId(ppid);
    Result update = updateRef.update();
    assertEquals(Result.NEW, update);
    assertEquals(ppid, db.resolve("HEAD"));
    Ref ref = db.getRef("HEAD");
    assertEquals("HEAD", ref.getName());
    assertTrue("is detached", !ref.isSymbolic());
View Full Code Here

  public void testDeleteLoosePacked() throws IOException {
    ObjectId pid = db.resolve("refs/heads/c^");
    RefUpdate updateRef = db.updateRef("refs/heads/c");
    updateRef.setNewObjectId(pid);
    updateRef.setForceUpdate(true);
    Result update = updateRef.update();
    assertEquals(Result.FORCED, update); // internal

    // The real test here
    RefUpdate updateRef2 = db.updateRef("refs/heads/c");
    updateRef2.setForceUpdate(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.