|
|
@ -60,7 +60,7 @@ public class ReflogResolveTest extends RepositoryTestCase { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveMasterCommits() throws Exception { |
|
|
|
public void resolveMasterCommits() throws Exception { |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
RevCommit c1 = git.commit().setMessage("create file").call(); |
|
|
|
RevCommit c1 = git.commit().setMessage("create file").call(); |
|
|
@ -71,10 +71,11 @@ public class ReflogResolveTest extends RepositoryTestCase { |
|
|
|
assertEquals(c2, db.resolve("master@{0}")); |
|
|
|
assertEquals(c2, db.resolve("master@{0}")); |
|
|
|
assertEquals(c1, db.resolve("master@{1}")); |
|
|
|
assertEquals(c1, db.resolve("master@{1}")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveUnnamedCurrentBranchCommits() throws Exception { |
|
|
|
public void resolveUnnamedCurrentBranchCommits() throws Exception { |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
RevCommit c1 = git.commit().setMessage("create file").call(); |
|
|
|
RevCommit c1 = git.commit().setMessage("create file").call(); |
|
|
@ -103,10 +104,11 @@ public class ReflogResolveTest extends RepositoryTestCase { |
|
|
|
assertEquals(c1, db.resolve("@{1}")); |
|
|
|
assertEquals(c1, db.resolve("@{1}")); |
|
|
|
assertEquals(c2, db.resolve("@{2}")); |
|
|
|
assertEquals(c2, db.resolve("@{2}")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveReflogParent() throws Exception { |
|
|
|
public void resolveReflogParent() throws Exception { |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
RevCommit c1 = git.commit().setMessage("create file").call(); |
|
|
|
RevCommit c1 = git.commit().setMessage("create file").call(); |
|
|
@ -116,19 +118,21 @@ public class ReflogResolveTest extends RepositoryTestCase { |
|
|
|
|
|
|
|
|
|
|
|
assertEquals(c1, db.resolve("master@{0}~1")); |
|
|
|
assertEquals(c1, db.resolve("master@{0}~1")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveNonExistingBranch() throws Exception { |
|
|
|
public void resolveNonExistingBranch() throws Exception { |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
git.commit().setMessage("create file").call(); |
|
|
|
git.commit().setMessage("create file").call(); |
|
|
|
assertNull(db.resolve("notabranch@{7}")); |
|
|
|
assertNull(db.resolve("notabranch@{7}")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolvePreviousBranch() throws Exception { |
|
|
|
public void resolvePreviousBranch() throws Exception { |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
RevCommit c1 = git.commit().setMessage("create file").call(); |
|
|
|
RevCommit c1 = git.commit().setMessage("create file").call(); |
|
|
@ -159,10 +163,11 @@ public class ReflogResolveTest extends RepositoryTestCase { |
|
|
|
|
|
|
|
|
|
|
|
assertEquals(c2.getName(), db.resolve("@{-3}@{0}").getName()); |
|
|
|
assertEquals(c2.getName(), db.resolve("@{-3}@{0}").getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void resolveDate() throws Exception { |
|
|
|
public void resolveDate() throws Exception { |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
writeTrashFile("file.txt", "content"); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
git.add().addFilepattern("file.txt").call(); |
|
|
|
git.commit().setMessage("create file").call(); |
|
|
|
git.commit().setMessage("create file").call(); |
|
|
@ -173,4 +178,5 @@ public class ReflogResolveTest extends RepositoryTestCase { |
|
|
|
assertNotNull(e); |
|
|
|
assertNotNull(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |