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:
authorDouwe Maan <douwe@selenight.nl>2016-07-04 02:58:58 +0300
committerDouwe Maan <douwe@selenight.nl>2016-07-04 07:11:33 +0300
commit3286dd7a1db69460573a5fd2c9e997039b1f406b (patch)
treefba63dd375acb038a1e27f03eb9ba7530578cefd /app/models/todo.rb
parent0ccdc631e6f45c0fd327631decb47f80d781302e (diff)
Don't garbage collect commits that have related DB records like comments
Diffstat (limited to 'app/models/todo.rb')
-rw-r--r--app/models/todo.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/todo.rb b/app/models/todo.rb
index 3ba67078d48..ac3fdbc7f3b 100644
--- a/app/models/todo.rb
+++ b/app/models/todo.rb
@@ -37,6 +37,8 @@ class Todo < ActiveRecord::Base
state :done
end
+ after_save :keep_around_commit
+
def build_failed?
action == BUILD_FAILED
end
@@ -73,4 +75,10 @@ class Todo < ActiveRecord::Base
target.to_reference
end
end
+
+ private
+
+ def keep_around_commit
+ project.repository.keep_around(self.commit_id)
+ end
end