Download & Extend

hook_operation is called twice for backends on inserts

Project:Version Control API
Version:6.x-1.0-rc1
Component:API module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi,
prolly yet another API change, but from reading the code it looks like that hook_versioncontrol_operation is called twice for insert operations

<?php
 
// Notify the backend first.
 
if (versioncontrol_backend_implements($vcs, 'operation')) {
   
_versioncontrol_call_backend($vcs, 'operation', array(
     
'insert', $operation, $operation_items
   
));
  }
 
// Everything's done, let the world know about it!
 
module_invoke_all('versioncontrol_operation',
   
'insert', $operation, $operation_items
 
);
?>

You'd probably want to change the name of the hook for the backend...
BTW, please don't release any final version of VCS API, I've some serious issues with the git backend which maybe bugs in VCS API. I'll talk in irc about this when i see you again.

Comments

#1

Status:active» closed (fixed)

Nope, that's actually intended this way. The difference is that _versioncontrol_call_backend() only prefixes the module name to the function, whereas the module_invoke_all() call prefixes both the module name and "versioncontrol_". So these are two distinct functions, and unless the backend implements both of them it won't be called twice in such cases.

nobody click here