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:
@@ -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;
|
||||
|
||||
@@ -53,6 +53,7 @@ public class RefUpdateUtilTest {
|
||||
|
||||
@Test
|
||||
public void checkBatchRefUpdateResults() throws Exception {
|
||||
checkResults();
|
||||
checkResults(OK);
|
||||
checkResults(OK, OK);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user