Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-10-13 16:19:52 +0300
committerSean McGivern <sean@gitlab.com>2016-10-13 18:15:38 +0300
commit776cea4c00d883cafc2bc5381f3b61b146a93976 (patch)
tree469990cf140f9558320a5aab9c1ca46850c17a98 /app/models/deployment.rb
parenta053430e94e21bbf81524304f9b52a106f654b54 (diff)
Handle case where deployment ref no longer exists
Keep-around refs for deployments were only introduced in 8.10, so any deployment created in 8.9 could have a SHA pointing to a commit that no longer exists in the repository. We can't do anything useful with those deployments, so make `#includes_commit?` always return false for those.
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r--app/models/deployment.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 82b27b78229..f63cc179b9e 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!