diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-03 14:35:07 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-03 14:35:07 +0300 |
commit | d5adeb1f781cd92c70453b5e4273d4afe5b5a2d1 (patch) | |
tree | f8bd79c49f75cc446095a75ec48eccd68e13d90d /lib/gitlab_update.rb | |
parent | ce88b74d52410250427116349d06a74359a65b48 (diff) | |
parent | f79bb5a307cd8ec5fa1c765779640667e70da5b4 (diff) | |
download | gitlab-shell-d5adeb1f781cd92c70453b5e4273d4afe5b5a2d1.tar.gz |
Merge pull request #128 from Popl7/add-better-branch-protection-against-history-rewrite-and-deletion
protect protected branched to force updates
Diffstat (limited to 'lib/gitlab_update.rb')
-rw-r--r-- | lib/gitlab_update.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab_update.rb b/lib/gitlab_update.rb index 742d5fd..43d5b07 100644 --- a/lib/gitlab_update.rb +++ b/lib/gitlab_update.rb @@ -22,12 +22,17 @@ class GitlabUpdate @newrev = ARGV[2] end + def forced_push? + missed_refs = IO.popen(%W(git rev-list #{@newrev}..#{@oldrev} --)).read + missed_refs.split("\n").size > 0 + end + def exec # reset GL_ID env since we already # get value from it ENV['GL_ID'] = nil - if api.allowed?('git-receive-pack', @repo_name, @actor, @ref_name, @oldrev, @newrev) + if api.allowed?('git-receive-pack', @repo_name, @actor, @ref_name, @oldrev, @newrev, forced_push) update_redis exit 0 else |