Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
5255a54d
Commit
5255a54d
authored
Feb 17, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored some stuff based on MR feedback
parent
20e79f71
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
63 deletions
+34
-63
app/services/git_push_service.rb
app/services/git_push_service.rb
+3
-3
app/workers/post_receive.rb
app/workers/post_receive.rb
+1
-6
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+30
-54
No files found.
app/services/git_push_service.rb
View file @
5255a54d
...
...
@@ -106,7 +106,7 @@ class GitPushService < BaseService
def
build_push_data
@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
def
push_to_existing_branch?
...
...
@@ -128,7 +128,7 @@ class GitPushService < BaseService
def
is_default_branch?
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
def
commit_user
(
commit
)
...
...
@@ -136,6 +136,6 @@ class GitPushService < BaseService
end
def
branch_name
@
_
branch_name
||=
Gitlab
::
Git
.
ref_name
(
params
[
:ref
])
@branch_name
||=
Gitlab
::
Git
.
ref_name
(
params
[
:ref
])
end
end
app/workers/post_receive.rb
View file @
5255a54d
...
...
@@ -38,12 +38,7 @@ class PostReceive
if
Gitlab
::
Git
.
tag_ref?
(
ref
)
GitTagPushService
.
new
.
execute
(
project
,
@user
,
oldrev
,
newrev
,
ref
)
else
GitPushService
.
new
(
project
,
@user
,
{
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
}).
execute
GitPushService
.
new
(
project
,
@user
,
oldrev:
oldrev
,
newrev:
newrev
,
ref:
ref
).
execute
end
end
end
...
...
spec/services/git_push_service_spec.rb
View file @
5255a54d
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment