summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 83400c9e533..80dd02981c1 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -335,7 +335,11 @@ class Commit
strong_memoize(:raw_signature_type) do
next unless @raw.instance_of?(Gitlab::Git::Commit)
- @raw.raw_commit.signature_type if defined? @raw.raw_commit.signature_type
+ if raw_commit_from_rugged? && gpg_commit.signature_text.present?
+ :PGP
+ elsif defined? @raw.raw_commit.signature_type
+ @raw.raw_commit.signature_type
+ end
end
end
@@ -347,7 +351,7 @@ class Commit
strong_memoize(:signature) do
case signature_type
when :PGP
- Gitlab::Gpg::Commit.new(self).signature
+ gpg_commit.signature
when :X509
Gitlab::X509::Commit.new(self).signature
else
@@ -356,6 +360,14 @@ class Commit
end
end
+ def raw_commit_from_rugged?
+ @raw.raw_commit.is_a?(Rugged::Commit)
+ end
+
+ def gpg_commit
+ @gpg_commit ||= Gitlab::Gpg::Commit.new(self)
+ end
+
def revert_branch_name
"revert-#{short_id}"
end