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
Boxiang Sun
gitlab-ce
Commits
028ecb08
Commit
028ecb08
authored
Jun 16, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
need to wrap the raw commit in a commit model
parent
d7f42643
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
+2
-1
spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
+7
-2
No files found.
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
View file @
028ecb08
...
...
@@ -10,7 +10,8 @@ module Gitlab
.
where
(
valid_signature:
false
)
.
where
(
gpg_key_primary_keyid:
@gpg_key
.
primary_keyid
)
.
find_each
do
|
gpg_signature
|
commit
=
Gitlab
::
Git
::
Commit
.
find
(
gpg_signature
.
project
.
repository
,
gpg_signature
.
commit_sha
)
raw_commit
=
Gitlab
::
Git
::
Commit
.
find
(
gpg_signature
.
project
.
repository
,
gpg_signature
.
commit_sha
)
commit
=
::
Commit
.
new
(
raw_commit
,
gpg_signature
.
project
)
Gitlab
::
Gpg
::
Commit
.
new
(
commit
).
update_signature!
(
gpg_signature
)
end
end
...
...
spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
View file @
028ecb08
...
...
@@ -4,13 +4,18 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do
describe
'#run'
do
let!
(
:commit_sha
)
{
'0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
}
let!
(
:project
)
{
create
:project
,
:repository
,
path:
'sample-project'
}
let!
(
:commit
)
do
let!
(
:
raw_
commit
)
do
raw_commit
=
double
(
:raw_commit
,
signature:
[
GpgHelpers
::
User1
.
signed_commit_signature
,
GpgHelpers
::
User1
.
signed_commit_base_data
],
sha:
commit_sha
)
allow
(
raw_commit
).
to
receive
:save!
raw_commit
end
let!
(
:commit
)
do
create
:commit
,
git_commit:
raw_commit
,
project:
project
end
...
...
@@ -24,7 +29,7 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do
end
before
do
allow
(
Gitlab
::
Git
::
Commit
).
to
receive
(
:find
).
with
(
kind_of
(
Repository
),
commit_sha
).
and_return
(
commit
)
allow
(
Gitlab
::
Git
::
Commit
).
to
receive
(
:find
).
with
(
kind_of
(
Repository
),
commit_sha
).
and_return
(
raw_
commit
)
end
context
'gpg signature did not have an associated gpg key'
do
...
...
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