I am trying to validate a file on PreReceiveRepositoryHook and been following examples from atlassion site(https://bitbucket.org/roadsidepicnic/atlassian-bitbucket-check-commits-hook) and githup project (https://github.com/hmcmanus/yaml-validator-hook), neither one work because they can not find the commit just made. Anyone else facing same issue?
CommitRequest commitReq = new CommitRequest.Builder(repository, refChange.getToHash()).build();
Commit com1 = commitService.getCommit(commitReq);