Correct RefUpdateUtil to work for an empty BatchRefUpdate

RefUpdateUtil#checkResults should not throw a LockFailureException if
the BatchRefUpdate doesn't contain any commands. Instead, it should
silently do nothing as nothing was executed.

Change-Id: Ie8257f8f9eb487f1242cacf004e05357e3fb6317
This commit is contained in:
Alice Kober-Sotzek
2017-11-09 15:15:33 +01:00
parent e5ca19cf4b
commit ec492eda87
2 changed files with 5 additions and 0 deletions

View File

@@ -57,6 +57,10 @@ public class RefUpdateUtil {
*/
@VisibleForTesting
static void checkResults(BatchRefUpdate bru) throws IOException {
if (bru.getCommands().isEmpty()) {
return;
}
int lockFailure = 0;
int aborted = 0;
int failure = 0;

View File

@@ -53,6 +53,7 @@ public class RefUpdateUtilTest {
@Test
public void checkBatchRefUpdateResults() throws Exception {
checkResults();
checkResults(OK);
checkResults(OK, OK);