summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2015-10-12 16:42:14 +0200
committerMarin Jankovski <maxlazio@gmail.com>2015-11-16 12:39:13 +0100
commit14032d8eb1a60ae5920286249c1044be2fa27278 (patch)
tree78d27cfb47590f5c30b1ae75de60368c5e269cc9 /app/models/project.rb
parent9179fcece813d0fe54abb5d7a28874cfa799f9c5 (diff)
downloadgitlab-ce-14032d8eb1a60ae5920286249c1044be2fa27278.tar.gz
Add support for git lfs.lfs
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 3e72a9a46a0..9ea0d15497a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -124,6 +124,8 @@ class Project < ActiveRecord::Base
has_many :ci_commits, dependent: :destroy, class_name: 'Ci::Commit', foreign_key: :gl_project_id
has_many :ci_builds, through: :ci_commits, source: :builds, dependent: :destroy, class_name: 'Ci::Build'
has_many :releases, dependent: :destroy
+ has_many :lfs_objects_projects, dependent: :destroy
+ has_many :lfs_objects, through: :lfs_objects_projects
has_one :import_data, dependent: :destroy, class_name: "ProjectImportData"
has_one :gitlab_ci_project, dependent: :destroy, class_name: "Ci::Project", foreign_key: :gitlab_id
@@ -798,4 +800,14 @@ class Project < ActiveRecord::Base
def enable_ci
self.builds_enabled = true
end
+
+ def unlink_fork
+ if forked?
+ forked_from_project.lfs_objects.find_each do |lfs_object|
+ lfs_object.projects << self
+ end
+
+ forked_project_link.destroy
+ end
+ end
end