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
fdad5768
Commit
fdad5768
authored
Feb 19, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Error 500 when viewing a commit with a GPG signature in Geo
Closes gitlab-org/gitlab-ee#4825
parent
557db7e6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
changelogs/unreleased/sh-fix-geo-error-500-gpg-commit.yml
changelogs/unreleased/sh-fix-geo-error-500-gpg-commit.yml
+5
-0
lib/gitlab/gpg/commit.rb
lib/gitlab/gpg/commit.rb
+3
-1
spec/lib/gitlab/gpg/commit_spec.rb
spec/lib/gitlab/gpg/commit_spec.rb
+25
-1
No files found.
changelogs/unreleased/sh-fix-geo-error-500-gpg-commit.yml
0 → 100644
View file @
fdad5768
---
title
:
Fix Error 500 when viewing a commit with a GPG signature in Geo
merge_request
:
author
:
type
:
fixed
lib/gitlab/gpg/commit.rb
View file @
fdad5768
...
@@ -60,7 +60,9 @@ module Gitlab
...
@@ -60,7 +60,9 @@ module Gitlab
def
create_cached_signature!
def
create_cached_signature!
using_keychain
do
|
gpg_key
|
using_keychain
do
|
gpg_key
|
GpgSignature
.
create!
(
attributes
(
gpg_key
))
signature
=
GpgSignature
.
new
(
attributes
(
gpg_key
))
signature
.
save!
unless
Gitlab
::
Database
.
read_only?
signature
end
end
end
end
...
...
spec/lib/gitlab/gpg/commit_spec.rb
View file @
fdad5768
...
@@ -49,7 +49,9 @@ describe Gitlab::Gpg::Commit do
...
@@ -49,7 +49,9 @@ describe Gitlab::Gpg::Commit do
end
end
it
'returns a valid signature'
do
it
'returns a valid signature'
do
expect
(
described_class
.
new
(
commit
).
signature
).
to
have_attributes
(
signature
=
described_class
.
new
(
commit
).
signature
expect
(
signature
).
to
have_attributes
(
commit_sha:
commit_sha
,
commit_sha:
commit_sha
,
project:
project
,
project:
project
,
gpg_key:
gpg_key
,
gpg_key:
gpg_key
,
...
@@ -58,9 +60,31 @@ describe Gitlab::Gpg::Commit do
...
@@ -58,9 +60,31 @@ describe Gitlab::Gpg::Commit do
gpg_key_user_email:
GpgHelpers
::
User1
.
emails
.
first
,
gpg_key_user_email:
GpgHelpers
::
User1
.
emails
.
first
,
verification_status:
'verified'
verification_status:
'verified'
)
)
expect
(
signature
.
persisted?
).
to
be_truthy
end
end
it_behaves_like
'returns the cached signature on second call'
it_behaves_like
'returns the cached signature on second call'
context
'read-only mode'
do
before
do
allow
(
Gitlab
::
Database
).
to
receive
(
:read_only?
).
and_return
(
true
)
end
it
'does not create a cached signature'
do
signature
=
described_class
.
new
(
commit
).
signature
expect
(
signature
).
to
have_attributes
(
commit_sha:
commit_sha
,
project:
project
,
gpg_key:
gpg_key
,
gpg_key_primary_keyid:
GpgHelpers
::
User1
.
primary_keyid
,
gpg_key_user_name:
GpgHelpers
::
User1
.
names
.
first
,
gpg_key_user_email:
GpgHelpers
::
User1
.
emails
.
first
,
verification_status:
'verified'
)
expect
(
signature
.
persisted?
).
to
be_falsey
end
end
end
end
context
'commit signed with a subkey'
do
context
'commit signed with a subkey'
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