Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
be3d74e0
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
be3d74e0
编写于
11月 11, 2016
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not call environments service in repository model
上级
4a7fcc2a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
5 addition
and
27 deletion
+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
未找到文件。
app/models/repository.rb
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录