Refactoring pre-receive hook