ResetCommandTest: Use Git member in testHardResetAfterSquashMerge
Use the class member instance of the Git rather than creating a new one in the test. This makes it consistent with the other tests in the module. Change-Id: Ibe822ded76a80b94922e92bbc6f5d90bcc52f8a3 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
This commit is contained in:
parent
8074f50b58
commit
a176c6055a
|
@ -463,24 +463,24 @@ public void testHardResetOnTag() throws Exception {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHardResetAfterSquashMerge() throws Exception {
|
public void testHardResetAfterSquashMerge() throws Exception {
|
||||||
Git g = new Git(db);
|
git = new Git(db);
|
||||||
|
|
||||||
writeTrashFile("file1", "file1");
|
writeTrashFile("file1", "file1");
|
||||||
g.add().addFilepattern("file1").call();
|
git.add().addFilepattern("file1").call();
|
||||||
RevCommit first = g.commit().setMessage("initial commit").call();
|
RevCommit first = git.commit().setMessage("initial commit").call();
|
||||||
|
|
||||||
assertTrue(new File(db.getWorkTree(), "file1").exists());
|
assertTrue(new File(db.getWorkTree(), "file1").exists());
|
||||||
createBranch(first, "refs/heads/branch1");
|
createBranch(first, "refs/heads/branch1");
|
||||||
checkoutBranch("refs/heads/branch1");
|
checkoutBranch("refs/heads/branch1");
|
||||||
|
|
||||||
writeTrashFile("file2", "file2");
|
writeTrashFile("file2", "file2");
|
||||||
g.add().addFilepattern("file2").call();
|
git.add().addFilepattern("file2").call();
|
||||||
g.commit().setMessage("second commit").call();
|
git.commit().setMessage("second commit").call();
|
||||||
assertTrue(new File(db.getWorkTree(), "file2").exists());
|
assertTrue(new File(db.getWorkTree(), "file2").exists());
|
||||||
|
|
||||||
checkoutBranch("refs/heads/master");
|
checkoutBranch("refs/heads/master");
|
||||||
|
|
||||||
MergeResult result = g.merge()
|
MergeResult result = git.merge()
|
||||||
.include(db.exactRef("refs/heads/branch1"))
|
.include(db.exactRef("refs/heads/branch1"))
|
||||||
.setSquash(true)
|
.setSquash(true)
|
||||||
.call();
|
.call();
|
||||||
|
@ -489,7 +489,7 @@ public void testHardResetAfterSquashMerge() throws Exception {
|
||||||
result.getMergeStatus());
|
result.getMergeStatus());
|
||||||
assertNotNull(db.readSquashCommitMsg());
|
assertNotNull(db.readSquashCommitMsg());
|
||||||
|
|
||||||
assertSameAsHead(g.reset().setMode(ResetType.HARD)
|
assertSameAsHead(git.reset().setMode(ResetType.HARD)
|
||||||
.setRef(first.getName()).call());
|
.setRef(first.getName()).call());
|
||||||
|
|
||||||
assertNull(db.readSquashCommitMsg());
|
assertNull(db.readSquashCommitMsg());
|
||||||
|
|
Loading…
Reference in New Issue