Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
4aa2deb4
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,发现更多精彩内容 >>
提交
4aa2deb4
编写于
10月 07, 2017
作者:
R
Rubén Dávila
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix error with GPG signature updater when commit was deleted
上级
2ef28db9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
7 deletion
+25
-7
app/models/gpg_signature.rb
app/models/gpg_signature.rb
+2
-0
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
+1
-1
spec/models/gpg_signature_spec.rb
spec/models/gpg_signature_spec.rb
+22
-6
未找到文件。
app/models/gpg_signature.rb
浏览文件 @
4aa2deb4
...
...
@@ -60,6 +60,8 @@ class GpgSignature < ActiveRecord::Base
end
def
gpg_commit
return
unless
commit
Gitlab
::
Gpg
::
Commit
.
new
(
commit
)
end
end
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
浏览文件 @
4aa2deb4
...
...
@@ -10,7 +10,7 @@ module Gitlab
.
select
(
:id
,
:commit_sha
,
:project_id
)
.
where
(
'gpg_key_id IS NULL OR verification_status <> ?'
,
GpgSignature
.
verification_statuses
[
:verified
])
.
where
(
gpg_key_primary_keyid:
@gpg_key
.
keyids
)
.
find_each
{
|
sig
|
sig
.
gpg_commit
.
update_signature!
(
sig
)
}
.
find_each
{
|
sig
|
sig
.
gpg_commit
&
.
update_signature!
(
sig
)
}
end
end
end
...
...
spec/models/gpg_signature_spec.rb
浏览文件 @
4aa2deb4
require
'rails_helper'
RSpec
.
describe
GpgSignature
do
let
(
:commit_sha
)
{
'0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
path:
'sample-project'
)
}
let!
(
:commit
)
{
create
(
:commit
,
project:
project
,
sha:
commit_sha
)
}
let
(
:gpg_signature
)
{
create
(
:gpg_signature
,
commit_sha:
commit_sha
)
}
let
(
:gpg_key
)
{
create
(
:gpg_key
)
}
let
(
:gpg_key_subkey
)
{
create
(
:gpg_key_subkey
)
}
...
...
@@ -19,11 +23,6 @@ RSpec.describe GpgSignature do
describe
'#commit'
do
it
'fetches the commit through the project'
do
commit_sha
=
'0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
project
=
create
:project
,
:repository
commit
=
create
:commit
,
project:
project
gpg_signature
=
create
:gpg_signature
,
commit_sha:
commit_sha
expect_any_instance_of
(
Project
).
to
receive
(
:commit
).
with
(
commit_sha
).
and_return
(
commit
)
gpg_signature
.
commit
...
...
@@ -44,11 +43,28 @@ RSpec.describe GpgSignature do
end
it
'clears gpg_key and gpg_key_subkey_id when passing nil'
do
gpg_signature
=
create
(
:gpg_signature
,
gpg_key:
gpg_key_subkey
)
gpg_signature
.
update_attribute
(
:gpg_key
,
nil
)
expect
(
gpg_signature
.
gpg_key_id
).
to
be_nil
expect
(
gpg_signature
.
gpg_key_subkey_id
).
to
be_nil
end
end
describe
'#gpg_commit'
do
context
'when commit does not exist'
do
it
'returns nil'
do
allow
(
gpg_signature
).
to
receive
(
:commit
).
and_return
(
nil
)
expect
(
gpg_signature
.
gpg_commit
).
to
be_nil
end
end
context
'when commit exists'
do
it
'returns an instance of Gitlab::Gpg::Commit'
do
allow
(
gpg_signature
).
to
receive
(
:commit
).
and_return
(
commit
)
expect
(
gpg_signature
.
gpg_commit
).
to
be_an_instance_of
(
Gitlab
::
Gpg
::
Commit
)
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录