Merge changes from topic 'ref-validation-fixes' into stable-2.14
* changes: DeleteRef: Pass project name into validateRefOperation Be more consistent about object ids used in ref operation validation
This commit is contained in:
@@ -39,7 +39,7 @@ public class RefOperationValidators {
|
||||
|
||||
public static ReceiveCommand getCommand(RefUpdate update, ReceiveCommand.Type type) {
|
||||
return new ReceiveCommand(
|
||||
update.getOldObjectId(), update.getNewObjectId(), update.getName(), type);
|
||||
update.getExpectedOldObjectId(), update.getNewObjectId(), update.getName(), type);
|
||||
}
|
||||
|
||||
private final RefReceivedEvent event;
|
||||
|
||||
@@ -115,8 +115,10 @@ public class DeleteRef {
|
||||
}
|
||||
RefUpdate.Result result;
|
||||
RefUpdate u = r.updateRef(ref);
|
||||
u.setExpectedOldObjectId(r.exactRef(ref).getObjectId());
|
||||
u.setNewObjectId(ObjectId.zeroId());
|
||||
u.setForceUpdate(true);
|
||||
refDeletionValidator.validateRefOperation(ref, identifiedUser.get(), u);
|
||||
refDeletionValidator.validateRefOperation(resource.getName(), identifiedUser.get(), u);
|
||||
int remainingLockFailureCalls = MAX_LOCK_FAILURE_CALLS;
|
||||
for (; ; ) {
|
||||
try {
|
||||
@@ -222,6 +224,8 @@ public class DeleteRef {
|
||||
|
||||
RefUpdate u = r.updateRef(refName);
|
||||
u.setForceUpdate(true);
|
||||
u.setExpectedOldObjectId(r.exactRef(refName).getObjectId());
|
||||
u.setNewObjectId(ObjectId.zeroId());
|
||||
refDeletionValidator.validateRefOperation(project.getName(), identifiedUser.get(), u);
|
||||
return command;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user