replace is_default_branch?
with default_branch?
This commit is contained in:
parent
622c912d5b
commit
1c0def2a76
2 changed files with 7 additions and 7 deletions
|
@ -30,7 +30,7 @@ class GitPushService < BaseService
|
||||||
@project.repository.after_create_branch
|
@project.repository.after_create_branch
|
||||||
|
|
||||||
# Re-find the pushed commits.
|
# Re-find the pushed commits.
|
||||||
if is_default_branch?
|
if default_branch?
|
||||||
# Initial push to the default branch. Take the full history of that branch as "newly pushed".
|
# Initial push to the default branch. Take the full history of that branch as "newly pushed".
|
||||||
process_default_branch
|
process_default_branch
|
||||||
else
|
else
|
||||||
|
@ -50,7 +50,7 @@ class GitPushService < BaseService
|
||||||
|
|
||||||
# Update the bare repositories info/attributes file using the contents of the default branches
|
# Update the bare repositories info/attributes file using the contents of the default branches
|
||||||
# .gitattributes file
|
# .gitattributes file
|
||||||
update_gitattributes if is_default_branch?
|
update_gitattributes if default_branch?
|
||||||
end
|
end
|
||||||
|
|
||||||
execute_related_hooks
|
execute_related_hooks
|
||||||
|
@ -66,7 +66,7 @@ class GitPushService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_caches
|
def update_caches
|
||||||
if is_default_branch?
|
if default_branch?
|
||||||
if push_to_new_branch?
|
if push_to_new_branch?
|
||||||
# If this is the initial push into the default branch, the file type caches
|
# If this is the initial push into the default branch, the file type caches
|
||||||
# will already be reset as a result of `Project#change_head`.
|
# will already be reset as a result of `Project#change_head`.
|
||||||
|
@ -108,7 +108,7 @@ class GitPushService < BaseService
|
||||||
|
|
||||||
# Schedules processing of commit messages.
|
# Schedules processing of commit messages.
|
||||||
def process_commit_messages
|
def process_commit_messages
|
||||||
default = is_default_branch?
|
default = default_branch?
|
||||||
|
|
||||||
@push_commits.last(PROCESS_COMMIT_LIMIT).each do |commit|
|
@push_commits.last(PROCESS_COMMIT_LIMIT).each do |commit|
|
||||||
if commit.matches_cross_reference_regex?
|
if commit.matches_cross_reference_regex?
|
||||||
|
@ -202,7 +202,7 @@ class GitPushService < BaseService
|
||||||
Gitlab::Git.branch_ref?(params[:ref])
|
Gitlab::Git.branch_ref?(params[:ref])
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_default_branch?
|
def default_branch?
|
||||||
Gitlab::Git.branch_ref?(params[:ref]) &&
|
Gitlab::Git.branch_ref?(params[:ref]) &&
|
||||||
(Gitlab::Git.ref_name(params[:ref]) == project.default_branch || project.default_branch.nil?)
|
(Gitlab::Git.ref_name(params[:ref]) == project.default_branch || project.default_branch.nil?)
|
||||||
end
|
end
|
||||||
|
|
|
@ -617,7 +617,7 @@ describe GitPushService, services: true do
|
||||||
|
|
||||||
context 'on the default branch' do
|
context 'on the default branch' do
|
||||||
before do
|
before do
|
||||||
allow(service).to receive(:is_default_branch?).and_return(true)
|
allow(service).to receive(:default_branch?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'flushes the caches of any special files that have been changed' do
|
it 'flushes the caches of any special files that have been changed' do
|
||||||
|
@ -638,7 +638,7 @@ describe GitPushService, services: true do
|
||||||
|
|
||||||
context 'on a non-default branch' do
|
context 'on a non-default branch' do
|
||||||
before do
|
before do
|
||||||
allow(service).to receive(:is_default_branch?).and_return(false)
|
allow(service).to receive(:default_branch?).and_return(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not flush any conditional caches' do
|
it 'does not flush any conditional caches' do
|
||||||
|
|
Loading…
Reference in a new issue