Commit 5255a54d authored by James Lopez's avatar James Lopez

refactored some stuff based on MR feedback

parent 20e79f71
...@@ -106,7 +106,7 @@ class GitPushService < BaseService ...@@ -106,7 +106,7 @@ class GitPushService < BaseService
def build_push_data def build_push_data
@push_data ||= Gitlab::PushDataBuilder. @push_data ||= Gitlab::PushDataBuilder.
build(@project, current_user, params[:oldrev], params[:newrev], params[:ref], push_commits) build(@project, current_user, params[:oldrev], params[:newrev], params[:ref], push_commits)
end end
def push_to_existing_branch? def push_to_existing_branch?
...@@ -128,7 +128,7 @@ class GitPushService < BaseService ...@@ -128,7 +128,7 @@ class GitPushService < BaseService
def is_default_branch? def is_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
def commit_user(commit) def commit_user(commit)
...@@ -136,6 +136,6 @@ class GitPushService < BaseService ...@@ -136,6 +136,6 @@ class GitPushService < BaseService
end end
def branch_name def branch_name
@_branch_name ||= Gitlab::Git.ref_name(params[:ref]) @branch_name ||= Gitlab::Git.ref_name(params[:ref])
end end
end end
...@@ -38,12 +38,7 @@ class PostReceive ...@@ -38,12 +38,7 @@ class PostReceive
if Gitlab::Git.tag_ref?(ref) if Gitlab::Git.tag_ref?(ref)
GitTagPushService.new.execute(project, @user, oldrev, newrev, ref) GitTagPushService.new.execute(project, @user, oldrev, newrev, ref)
else else
GitPushService.new(project, @user, GitPushService.new(project, @user, oldrev: oldrev, newrev: newrev, ref: ref).execute
{
oldrev: oldrev,
newrev: newrev,
ref: ref
}).execute
end end
end end
end end
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment