summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2017-05-03 10:12:32 +0000
committerRémy Coutable <remy@rymai.me>2017-05-03 10:12:32 +0000
commit2174e37845f6865c20ba94da5520c8d9e874998f (patch)
tree1a6eb510ae73492e00d6d3621a3138d869c9d8fe /app/models/project.rb
parentd811004d023cee1ae5cbcb5792faca34b30336a3 (diff)
downloadgitlab-ce-2174e37845f6865c20ba94da5520c8d9e874998f.tar.gz
Include missing project attributes to Import/Export
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 6a8f8c3500f..025db89ebfd 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1271,6 +1271,9 @@ class Project < ActiveRecord::Base
else
update_attribute(name, value)
end
+
+ rescue ActiveRecord::RecordNotSaved => e
+ handle_update_attribute_error(e, value)
end
def pushes_since_gc
@@ -1392,4 +1395,16 @@ class Project < ActiveRecord::Base
ContainerRepository.build_root_repository(self).has_tags?
end
+
+ def handle_update_attribute_error(ex, value)
+ if ex.message.start_with?('Failed to replace')
+ if value.respond_to?(:each)
+ invalid = value.detect(&:invalid?)
+
+ raise ex, ([ex.message] + invalid.errors.full_messages).join(' ') if invalid
+ end
+ end
+
+ raise ex
+ end
end