diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 11:24:51 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 11:24:51 +0200 |
commit | 40528a1326208a04f95f18d6dcc7547cdb8ae0c3 (patch) | |
tree | 9e3f7ac86edfe03b218e3cd12ed9cae8b2b539f2 /app/models/deployment.rb | |
parent | 0e1f39d8cee3a6d23fccb195f8257178df840805 (diff) | |
parent | 052de0600c6b137e6f9df08250b4cf5f38280295 (diff) | |
download | gitlab-ce-40528a1326208a04f95f18d6dcc7547cdb8ae0c3.tar.gz |
Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mr
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r-- | app/models/deployment.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb index 070c76339b1..054d54f124e 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -40,7 +40,14 @@ class Deployment < ActiveRecord::Base def includes_commit?(commit) return false unless commit - project.repository.is_ancestor?(commit.id, sha) + # Before 8.10, deployments didn't have keep-around refs. Any deployment + # created before then could have a `sha` referring to a commit that no + # longer exists in the repository, so just ignore those. + begin + project.repository.is_ancestor?(commit.id, sha) + rescue Rugged::OdbError + false + end end def update_merge_request_metrics! @@ -90,6 +97,10 @@ class Deployment < ActiveRecord::Base close_action.present? end + def formatted_deployment_time + created_at.to_time.in_time_zone.to_s(:medium) + end + private def ref_path |