Merge branch 'master' of github.com:gitlabhq/gitlabhq
This commit is contained in:
commit
876c6f2491
|
@ -0,0 +1,5 @@
|
||||||
|
module Gitlab
|
||||||
|
module Git
|
||||||
|
BLANK_SHA = '0' * 40
|
||||||
|
end
|
||||||
|
end
|
|
@ -67,7 +67,7 @@ module Gitlab
|
||||||
if forced_push?(project, oldrev, newrev)
|
if forced_push?(project, oldrev, newrev)
|
||||||
:force_push_code_to_protected_branches
|
:force_push_code_to_protected_branches
|
||||||
# and we dont allow remove of protected branch
|
# and we dont allow remove of protected branch
|
||||||
elsif newrev =~ /0000000/
|
elsif newrev == Gitlab::Git::BLANK_SHA
|
||||||
:remove_protected_branches
|
:remove_protected_branches
|
||||||
else
|
else
|
||||||
:push_code_to_protected_branches
|
:push_code_to_protected_branches
|
||||||
|
@ -85,7 +85,7 @@ module Gitlab
|
||||||
def forced_push?(project, oldrev, newrev)
|
def forced_push?(project, oldrev, newrev)
|
||||||
return false if project.empty_repo?
|
return false if project.empty_repo?
|
||||||
|
|
||||||
if oldrev !~ /00000000/ && newrev !~ /00000000/
|
if oldrev != Gitlab::Git::BLANK_SHA && newrev != Gitlab::Git::BLANK_SHA
|
||||||
missed_refs = IO.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev})).read
|
missed_refs = IO.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev})).read
|
||||||
missed_refs.split("\n").size > 0
|
missed_refs.split("\n").size > 0
|
||||||
else
|
else
|
||||||
|
|
|
@ -55,12 +55,13 @@ describe Gitlab::GitAccess do
|
||||||
|
|
||||||
def changes
|
def changes
|
||||||
{
|
{
|
||||||
push_new_branch: '000000000 570e7b2ab refs/heads/wow',
|
push_new_branch: "#{Gitlab::Git::BLANK_SHA} 570e7b2ab refs/heads/wow",
|
||||||
push_master: '6f6d7e7ed 570e7b2ab refs/heads/master',
|
push_master: '6f6d7e7ed 570e7b2ab refs/heads/master',
|
||||||
push_protected_branch: '6f6d7e7ed 570e7b2ab refs/heads/feature',
|
push_protected_branch: '6f6d7e7ed 570e7b2ab refs/heads/feature',
|
||||||
push_remove_protected_branch: '570e7b2ab 000000000 refs/heads/feature',
|
push_remove_protected_branch: "570e7b2ab #{Gitlab::Git::BLANK_SHA} "\
|
||||||
|
'refs/heads/feature',
|
||||||
push_tag: '6f6d7e7ed 570e7b2ab refs/tags/v1.0.0',
|
push_tag: '6f6d7e7ed 570e7b2ab refs/tags/v1.0.0',
|
||||||
push_new_tag: '000000000 570e7b2ab refs/tags/v7.8.9',
|
push_new_tag: "#{Gitlab::Git::BLANK_SHA} 570e7b2ab refs/tags/v7.8.9",
|
||||||
push_all: ['6f6d7e7ed 570e7b2ab refs/heads/master', '6f6d7e7ed 570e7b2ab refs/heads/feature']
|
push_all: ['6f6d7e7ed 570e7b2ab refs/heads/master', '6f6d7e7ed 570e7b2ab refs/heads/feature']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue