diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-05-08 11:22:39 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-05-08 11:22:39 +0300 |
commit | 7dddff1ed5201b046d71212953b8011a0ce3fb34 (patch) | |
tree | 6cd90d92f93282b37b130f5f8d92d69e595fa82f /app | |
parent | a0920df2918d5f36f9f3bfd470e0c3c396534527 (diff) | |
parent | 1bd5896cd06e26130077632a4ac2d5cabd7be7d0 (diff) |
Merge branch 'dm-ensure-import-state-persisted' into 'master'
Don't create import_state until project is persisted
See merge request gitlab-org/gitlab-ce!18803
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index f6ac1802846..32d34f5e9b8 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -661,9 +661,15 @@ class Project < ActiveRecord::Base return if !force && (self[:import_status] == 'none' || self[:import_status].nil?) return unless import_state.nil? - create_import_state(import_state_args) + if persisted? + create_import_state(import_state_args) - update_column(:import_status, 'none') + update_column(:import_status, 'none') + else + build_import_state(import_state_args) + + self[:import_status] = 'none' + end end def import_schedule |