Move doRefUpdatedHook to validateForReceiveCommits
This means that doRefUpdatedHook() will be called for every commit pushed in chain instead of once for the whole chain. This is not ideal, and likely slow. This is being done in anticipation of moving hooks to a plugin, which requires making them fire off of events. There are already 2 validating event types for commits, and we don't really want to make a third. This at least allows it to run from a plugin. Change-Id: I5905c44c7df448a353263cbc0a79a48776cb0965
This commit is contained in:
@@ -897,19 +897,6 @@ public class ReceiveCommits {
|
||||
continue;
|
||||
}
|
||||
|
||||
HookResult result = hooks.doRefUpdateHook(project, cmd.getRefName(),
|
||||
user.getAccount(), cmd.getOldId(),
|
||||
cmd.getNewId());
|
||||
|
||||
if (result != null) {
|
||||
final String message = result.toString().trim();
|
||||
if (result.getExitValue() != 0) {
|
||||
reject(cmd, message);
|
||||
continue;
|
||||
}
|
||||
rp.sendMessage(message);
|
||||
}
|
||||
|
||||
if (MagicBranch.isMagicBranch(cmd.getRefName())) {
|
||||
parseMagicBranch(cmd);
|
||||
continue;
|
||||
|
@@ -131,6 +131,7 @@ public class CommitValidators {
|
||||
validators.add(new ConfigValidator(refControl, repo));
|
||||
validators.add(new BannedCommitsValidator(rejectCommits));
|
||||
validators.add(new PluginCommitValidationListener(commitValidationListeners));
|
||||
validators.add(new ChangeHookValidator(refControl, hooks));
|
||||
|
||||
List<CommitValidationMessage> messages = new LinkedList<>();
|
||||
|
||||
|
Reference in New Issue
Block a user