|
|
@ -57,24 +57,27 @@ public class ReflogTest extends CLIRepositoryTestCase { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testSingleCommit() throws Exception { |
|
|
|
public void testSingleCommit() throws Exception { |
|
|
|
new Git(db).commit().setMessage("initial commit").call(); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
|
|
|
|
git.commit().setMessage("initial commit").call(); |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("6fd41be HEAD@{0}: commit (initial): initial commit", |
|
|
|
assertEquals("6fd41be HEAD@{0}: commit (initial): initial commit", |
|
|
|
execute("git reflog")[0]); |
|
|
|
execute("git reflog")[0]); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testBranch() throws Exception { |
|
|
|
public void testBranch() throws Exception { |
|
|
|
Git git = new Git(db); |
|
|
|
try (Git git = new Git(db)) { |
|
|
|
git.commit().setMessage("first commit").call(); |
|
|
|
git.commit().setMessage("first commit").call(); |
|
|
|
git.checkout().setCreateBranch(true).setName("side").call(); |
|
|
|
git.checkout().setCreateBranch(true).setName("side").call(); |
|
|
|
writeTrashFile("file", "side content"); |
|
|
|
writeTrashFile("file", "side content"); |
|
|
|
git.add().addFilepattern("file").call(); |
|
|
|
git.add().addFilepattern("file").call(); |
|
|
|
git.commit().setMessage("side commit").call(); |
|
|
|
git.commit().setMessage("side commit").call(); |
|
|
|
|
|
|
|
|
|
|
|
assertArrayEquals(new String[] { |
|
|
|
assertArrayEquals(new String[] { |
|
|
|
"38890c7 side@{0}: commit: side commit", |
|
|
|
"38890c7 side@{0}: commit: side commit", |
|
|
|
"d216986 side@{1}: branch: Created from commit first commit", |
|
|
|
"d216986 side@{1}: branch: Created from commit first commit", |
|
|
|
"" }, execute("git reflog refs/heads/side")); |
|
|
|
"" }, execute("git reflog refs/heads/side")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |