|
|
@ -265,6 +265,16 @@ public class TestRepositoryTest { |
|
|
|
assertEquals("bar contents", blobAsString(amended, "bar")); |
|
|
|
assertEquals("bar contents", blobAsString(amended, "bar")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void commitToUnbornHead() throws Exception { |
|
|
|
|
|
|
|
repo.updateRef("HEAD").link("refs/heads/master"); |
|
|
|
|
|
|
|
RevCommit root = tr.branch("HEAD").commit().create(); |
|
|
|
|
|
|
|
Ref ref = repo.getRef(Constants.HEAD); |
|
|
|
|
|
|
|
assertEquals(root, ref.getObjectId()); |
|
|
|
|
|
|
|
assertTrue(ref.isSymbolic()); |
|
|
|
|
|
|
|
assertEquals("refs/heads/master", ref.getTarget().getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String blobAsString(AnyObjectId treeish, String path) |
|
|
|
private String blobAsString(AnyObjectId treeish, String path) |
|
|
|
throws Exception { |
|
|
|
throws Exception { |
|
|
|
RevObject obj = tr.get(rw.parseTree(treeish), path); |
|
|
|
RevObject obj = tr.get(rw.parseTree(treeish), path); |
|
|
|