Avoid error-prone warning

GC.gc() returns a Future, which should not be discarded. See also
https://errorprone.info/bugpattern/FutureReturnValueIgnored

Change-Id: I343cc3cfe74a564ad7f8d53f0fe9d96a23aaed00
This commit is contained in:
Han-Wen Nienhuys 2023-01-31 23:23:44 +01:00
parent b30c75be40
commit 9dfd2ff665
3 changed files with 10 additions and 10 deletions

View File

@ -90,7 +90,7 @@ public void testWriteWhenGc() throws Exception {
bb.update(tip);
assertTrue(gc.shouldWriteCommitGraphWhenGc());
gc.gc();
gc.gc().get();
File graphFile = new File(repo.getObjectsDirectory(),
Constants.INFO_COMMIT_GRAPH);
assertGraphFile(graphFile);
@ -103,7 +103,7 @@ public void testDefaultWriteWhenGc() throws Exception {
bb.update(tip);
assertFalse(gc.shouldWriteCommitGraphWhenGc());
gc.gc();
gc.gc().get();
File graphFile = new File(repo.getObjectsDirectory(),
Constants.INFO_COMMIT_GRAPH);
assertFalse(graphFile.exists());
@ -123,21 +123,21 @@ public void testDisableWriteWhenGc() throws Exception {
config.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, true);
gc.gc();
gc.gc().get();
assertFalse(graphFile.exists());
config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_COMMIT_GRAPH, true);
config.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, false);
gc.gc();
gc.gc().get();
assertFalse(graphFile.exists());
config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_COMMIT_GRAPH, false);
config.setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, false);
gc.gc();
gc.gc().get();
assertFalse(graphFile.exists());
}

View File

@ -247,7 +247,7 @@ public void testWindowCursorGetCommitGraph() throws Exception {
assertTrue(curs.getCommitGraph().isEmpty());
commitFile("file.txt", "content", "master");
GC gc = new GC(db);
gc.gc();
gc.gc().get();
assertTrue(curs.getCommitGraph().isPresent());
db.getConfig().setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
@ -286,7 +286,7 @@ public void testGetCommitGraph() throws Exception {
// add commit-graph
commitFile("file.txt", "content", "master");
GC gc = new GC(db);
gc.gc();
gc.gc().get();
File file = new File(db.getObjectsDirectory(),
Constants.INFO_COMMIT_GRAPH);
assertTrue(file.exists());
@ -296,7 +296,7 @@ public void testGetCommitGraph() throws Exception {
// update commit-graph
commitFile("file2.txt", "content", "master");
gc.gc();
gc.gc().get();
assertEquals(2, dir.getCommitGraph().get().getCommitCnt());
// delete commit-graph
@ -311,7 +311,7 @@ public void testGetCommitGraph() throws Exception {
assertTrue(dir.getCommitGraph().isEmpty());
// add commit-graph again
gc.gc();
gc.gc().get();
assertTrue(dir.getCommitGraph().isPresent());
assertEquals(2, dir.getCommitGraph().get().getCommitCnt());
}

View File

@ -309,7 +309,7 @@ void enableAndWriteCommitGraph() throws Exception {
db.getConfig().setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, true);
GC gc = new GC(db);
gc.gc();
gc.gc().get();
}
private void reinitializeRevWalk() {