Browse Source

RefUpdateTest: Don't call createBareRepository in try-with-resource

createBareRepository adds the created repo to the list of repos to be
closed in the superclass's teardown. Wrapping it in try-with-resource
causes it to be closed too many times, resulting in a corrupt use
count.

Change-Id: I4c70630bf6008544324dda453deb141f4f89472c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.7
David Pursehouse 8 years ago committed by Matthias Sohn
parent
commit
ac6353e9e5
  1. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefUpdateTest.java

@ -239,15 +239,15 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase {
@Test @Test
public void testDeleteHeadInBareRepo() throws IOException { public void testDeleteHeadInBareRepo() throws IOException {
try (Repository bareRepo = createBareRepository()) { Repository bareRepo = createBareRepository();
RefUpdate ref = bareRepo.updateRef(Constants.HEAD); RefUpdate ref = bareRepo.updateRef(Constants.HEAD);
ref.setNewObjectId(ObjectId.fromString("0123456789012345678901234567890123456789")); ref.setNewObjectId(ObjectId
.fromString("0123456789012345678901234567890123456789"));
// Create the HEAD ref so we can delete it. // Create the HEAD ref so we can delete it.
assertEquals(Result.NEW, ref.update()); assertEquals(Result.NEW, ref.update());
ref = bareRepo.updateRef(Constants.HEAD); ref = bareRepo.updateRef(Constants.HEAD);
delete(bareRepo, ref, Result.NO_CHANGE, true, true); delete(bareRepo, ref, Result.NO_CHANGE, true, true);
} }
}
/** /**
* Delete a loose ref and make sure the directory in refs is deleted too, * Delete a loose ref and make sure the directory in refs is deleted too,
* and the reflog dir too * and the reflog dir too

Loading…
Cancel
Save