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
Jérome Perrin
gitlab-ce
Commits
be3d74e0
Commit
be3d74e0
authored
Nov 11, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not call environments service in repository model
parent
4a7fcc2a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
27 deletions
+5
-27
app/models/repository.rb
app/models/repository.rb
+2
-13
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-1
lib/gitlab/github_import/importer.rb
lib/gitlab/github_import/importer.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+1
-12
No files found.
app/models/repository.rb
View file @
be3d74e0
...
...
@@ -203,7 +203,7 @@ class Repository
update_ref!
(
ref
,
newrev
,
oldrev
)
end
after_remove_branch
(
user
,
branch_name
)
after_remove_branch
true
end
...
...
@@ -524,12 +524,7 @@ class Repository
end
# Runs code after an existing branch has been removed.
def
after_remove_branch
(
user
,
branch_name
)
expire_branch_cache_after_removal
stop_environments_for_branch
(
user
,
branch_name
)
end
def
expire_branch_cache_after_removal
def
after_remove_branch
expire_has_visible_content_cache
expire_branch_count_cache
expire_branches_cache
...
...
@@ -1170,10 +1165,4 @@ class Repository
def
repository_event
(
event
,
tags
=
{})
Gitlab
::
Metrics
.
add_event
(
event
,
{
path:
path_with_namespace
}.
merge
(
tags
))
end
def
stop_environments_for_branch
(
user
,
branch_name
)
Ci
::
StopEnvironmentService
.
new
(
@project
,
user
)
.
execute
(
branch_name
)
end
end
app/services/git_push_service.rb
View file @
be3d74e0
...
...
@@ -21,7 +21,7 @@ class GitPushService < BaseService
@project
.
repository
.
after_push_commit
(
branch_name
,
params
[
:newrev
])
if
push_remove_branch?
@project
.
repository
.
after_remove_branch
(
current_user
,
branch_name
)
@project
.
repository
.
after_remove_branch
@push_commits
=
[]
elsif
push_to_new_branch?
@project
.
repository
.
after_create_branch
...
...
lib/gitlab/github_import/importer.rb
View file @
be3d74e0
...
...
@@ -111,7 +111,7 @@ module Gitlab
end
end
project
.
repository
.
expire_branch_cache_after_removal
project
.
repository
.
after_remove_branch
end
def
restore_source_branch
(
pull_request
)
...
...
spec/models/repository_spec.rb
View file @
be3d74e0
...
...
@@ -1182,18 +1182,7 @@ describe Repository, models: true do
it
'flushes the visible content cache'
do
expect
(
repository
).
to
receive
(
:expire_has_visible_content_cache
)
repository
.
after_remove_branch
(
user
,
'master'
)
end
context
'when there is environment with review app available for branch'
do
before
do
create
(
:environment
,
:with_review_app
,
project:
project
)
end
it
'stops environment'
do
expect_any_instance_of
(
Environment
).
to
receive
(
:stop!
)
repository
.
after_remove_branch
(
user
,
'master'
)
end
repository
.
after_remove_branch
end
end
...
...
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