Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
fd46d6ce
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
fd46d6ce
编写于
1月 30, 2018
作者:
Z
Zeger-Jan van de Weg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove intermediate methods on Branch and Tag classes
上级
73bd48de
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
28 deletion
+17
-28
lib/gitlab/git/branch.rb
lib/gitlab/git/branch.rb
+5
-11
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-2
lib/gitlab/git/tag.rb
lib/gitlab/git/tag.rb
+0
-6
lib/gitlab/gitaly_client/ref_service.rb
lib/gitlab/gitaly_client/ref_service.rb
+10
-9
未找到文件。
lib/gitlab/git/branch.rb
浏览文件 @
fd46d6ce
module
Gitlab
module
Git
class
Branch
<
Ref
class
<<
self
def
find
(
repo
,
branch_name
)
if
branch_name
.
is_a?
(
Gitlab
::
Git
::
Branch
)
branch_name
else
repo
.
find_branch
(
branch_name
)
end
end
def
names_contains_sha
(
repo
,
sha
,
limit:
0
)
GitalyClient
::
RefService
.
new
(
repo
).
branch_names_contains_sha
(
sha
)
def
self
.
find
(
repo
,
branch_name
)
if
branch_name
.
is_a?
(
Gitlab
::
Git
::
Branch
)
branch_name
else
repo
.
find_branch
(
branch_name
)
end
end
...
...
lib/gitlab/git/repository.rb
浏览文件 @
fd46d6ce
...
...
@@ -1358,7 +1358,7 @@ module Gitlab
def
branch_names_contains_sha
(
sha
)
gitaly_migrate
(
:branch_names_contains_sha
)
do
|
is_enabled
|
if
is_enabled
Gitlab
::
Git
::
Branch
.
names_contains_sha
(
self
,
sha
)
gitaly_ref_client
.
branch_names_contains_sha
(
sha
)
else
refs_contains_sha
(
:branch
,
sha
)
end
...
...
@@ -1368,7 +1368,7 @@ module Gitlab
def
tag_names_contains_sha
(
sha
)
gitaly_migrate
(
:tag_names_contains_sha
)
do
|
is_enabled
|
if
is_enabled
Gitlab
::
Git
::
Tag
.
names_contains_sha
(
self
,
sha
)
gitaly_ref_client
.
tag_names_contains_sha
(
sha
)
else
refs_contains_sha
(
:tag
,
sha
)
end
...
...
lib/gitlab/git/tag.rb
浏览文件 @
fd46d6ce
module
Gitlab
module
Git
class
Tag
<
Ref
class
<<
self
def
names_contains_sha
(
repo
,
sha
)
GitalyClient
::
RefService
.
new
(
repo
).
branch_names_contains_sha
(
sha
)
end
end
attr_reader
:object_sha
def
initialize
(
repository
,
name
,
target
,
target_commit
,
message
=
nil
)
...
...
lib/gitlab/gitaly_client/ref_service.rb
浏览文件 @
fd46d6ce
...
...
@@ -146,7 +146,7 @@ module Gitlab
end
# Limit: 0 implies no limit, thus all tag names will be returned
def
tag_names_contain
ing
(
sha
,
limit:
0
)
def
tag_names_contain
s_sha
(
sha
,
limit:
0
)
request
=
Gitaly
::
ListTagNamesContainingCommitRequest
.
new
(
repository:
@gitaly_repo
,
commit_id:
sha
,
...
...
@@ -155,10 +155,7 @@ module Gitlab
stream
=
GitalyClient
.
call
(
@repository
.
storage
,
:ref_service
,
:list_tag_names_containing_commit
,
request
)
stream
.
each_with_object
([])
do
|
response
,
array
|
encoded_names
=
response
.
tag_names
.
map
{
|
t
|
Gitlab
::
Git
.
ref_name
(
t
)
}
array
.
concat
(
encoded_names
)
end
consume_ref_contains_sha_response
(
stream
,
:tag_names
)
end
# Limit: 0 implies no limit, thus all tag names will be returned
...
...
@@ -171,10 +168,7 @@ module Gitlab
stream
=
GitalyClient
.
call
(
@repository
.
storage
,
:ref_service
,
:list_branch_names_containing_commit
,
request
)
stream
.
each_with_object
([])
do
|
response
,
array
|
encoded_names
=
response
.
branch_names
.
map
{
|
b
|
Gitlab
::
Git
.
ref_name
(
b
)
}
array
.
concat
(
encoded_names
)
end
consume_ref_contains_sha_response
(
stream
,
:branch_names
)
end
private
...
...
@@ -247,6 +241,13 @@ module Gitlab
Gitlab
::
Git
::
Commit
.
decorate
(
@repository
,
hash
)
end
def
consume_ref_contains_sha_response
(
stream
,
collection_name
)
stream
.
each_with_object
([])
do
|
response
,
array
|
encoded_names
=
response
.
send
(
collection_name
).
map
{
|
b
|
Gitlab
::
Git
.
ref_name
(
b
)
}
# rubocop:disable GitlabSecurity/PublicSend
array
.
concat
(
encoded_names
)
end
end
def
invalid_ref!
(
message
)
raise
Gitlab
::
Git
::
Repository
::
InvalidRef
.
new
(
message
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录