summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-19 13:02:49 +0000
committerRémy Coutable <remy@rymai.me>2016-09-19 13:02:49 +0000
commit1e72de669018252c2eb0bc086d66c74cfbbe1a0a (patch)
tree4ee88a17d44f1ba0cd3979e9ed3f07daed044b1c /app
parentc20e4267e89c1fa84b3eeb9f63e17677388c25e3 (diff)
parent0a3d2d7c2b97b228860aa5618bda5978a30084eb (diff)
downloadgitlab-ce-1e72de669018252c2eb0bc086d66c74cfbbe1a0a.tar.gz
Merge branch 'fix/import-export-db-errors' into 'master'
Fix import/export database errors Fixes protected branches errors when importing a project including them Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21295 Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21799 See merge request !6099
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/pipeline.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 0b1df9f4294..70647b8532b 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -2,6 +2,7 @@ module Ci
class Pipeline < ActiveRecord::Base
extend Ci::Model
include HasStatus
+ include Importable
self.table_name = 'ci_commits'
@@ -12,12 +13,12 @@ module Ci
has_many :builds, class_name: 'Ci::Build', foreign_key: :commit_id
has_many :trigger_requests, dependent: :destroy, class_name: 'Ci::TriggerRequest', foreign_key: :commit_id
- validates_presence_of :sha
- validates_presence_of :ref
- validates_presence_of :status
- validate :valid_commit_sha
+ validates_presence_of :sha, unless: :importing?
+ validates_presence_of :ref, unless: :importing?
+ validates_presence_of :status, unless: :importing?
+ validate :valid_commit_sha, unless: :importing?
- after_save :keep_around_commits
+ after_save :keep_around_commits, unless: :importing?
delegate :stages, to: :statuses