diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-07-25 16:18:33 -0400 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-07-27 11:13:19 -0400 |
commit | 0625d469d6645d90eeab18449b70b6d2463085ce (patch) | |
tree | d929996b6ebdc342bcb1c60b758a54b95725ee93 /hooks | |
parent | 522567afca91f2e04871e3d9bf8e9884f48a9855 (diff) | |
download | gitlab-shell-0625d469d6645d90eeab18449b70b6d2463085ce.tar.gz |
Track ongoing pushes and reject mv-storage commands if there are push running (after waiting some time)mv-storage
Diffstat (limited to 'hooks')
-rwxr-xr-x | hooks/pre-receive | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/hooks/pre-receive b/hooks/pre-receive index 66cb97d..09fa42b 100755 --- a/hooks/pre-receive +++ b/hooks/pre-receive @@ -9,10 +9,16 @@ protocol = ENV.delete('GL_PROTOCOL') repo_path = Dir.pwd require_relative '../lib/gitlab_custom_hook' +require_relative '../lib/gitlab_reference_counter' require_relative '../lib/gitlab_access' +# It's important that on pre-receive `increase_reference_counter` gets executed +# last so that it only runs if everything else succeeded. On post-receive on the +# other hand, we run GitlabPostReceive first because the push is already done +# and we don't want to skip it if the custom hook fails. if GitlabAccess.new(repo_path, key_id, refs, protocol).exec && - GitlabCustomHook.new.pre_receive(refs, repo_path) + GitlabCustomHook.new.pre_receive(refs, repo_path) && + GitlabReferenceCounter.new(repo_path).increase exit 0 else exit 1 |