BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
fedacf52
Commit
fedacf52
authored
Sep 26, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-branch-rm' into 'master'
Fix branch removal Fix exception on post-receive worker when remove branch See merge request !1122
parents
87cf5b70
9ecd3bc6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
9 deletions
+33
-9
git_push_service.rb
app/services/git_push_service.rb
+7
-9
git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+26
-0
No files found.
app/services/git_push_service.rb
View file @
fedacf52
...
...
@@ -22,11 +22,8 @@ class GitPushService
project
.
update_repository_size
if
push_to_branch?
(
ref
)
if
push_to_existing_branch?
(
ref
,
oldrev
)
# Collect data for this git push
@push_commits
=
project
.
repository
.
commits_between
(
oldrev
,
newrev
)
project
.
update_merge_requests
(
oldrev
,
newrev
,
ref
,
@user
)
process_commit_messages
(
ref
)
if
push_remove_branch?
(
ref
,
newrev
)
@push_commits
=
[]
elsif
push_to_new_branch?
(
ref
,
oldrev
)
# Re-find the pushed commits.
if
is_default_branch?
(
ref
)
...
...
@@ -38,11 +35,12 @@ class GitPushService
# that shouldn't matter because we check for existing cross-references later.
@push_commits
=
project
.
repository
.
commits_between
(
project
.
default_branch
,
newrev
)
end
process_commit_messages
(
ref
)
elsif
push_remove_branch_branch?
(
ref
,
newrev
)
@push_commits
=
[]
elsif
push_to_existing_branch?
(
ref
,
oldrev
)
# Collect data for this git push
@push_commits
=
project
.
repository
.
commits_between
(
oldrev
,
newrev
)
project
.
update_merge_requests
(
oldrev
,
newrev
,
ref
,
@user
)
process_commit_messages
(
ref
)
end
@push_data
=
post_receive_data
(
oldrev
,
newrev
,
ref
)
...
...
spec/services/git_push_service_spec.rb
View file @
fedacf52
...
...
@@ -14,6 +14,32 @@ describe GitPushService do
@ref
=
'refs/heads/master'
end
describe
'Push branches'
do
context
'new branch'
do
subject
do
service
.
execute
(
project
,
user
,
@blankrev
,
@newrev
,
@ref
)
end
it
{
should
be_true
}
end
context
'existing branch'
do
subject
do
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
end
it
{
should
be_true
}
end
context
'rm branch'
do
subject
do
service
.
execute
(
project
,
user
,
@oldrev
,
@blankrev
,
@ref
)
end
it
{
should
be_true
}
end
end
describe
"Git Push Data"
do
before
do
service
.
execute
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
...
...
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