summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-03 16:50:28 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-03 16:50:28 +0100
commit3a0020a2ec5fa4688a8f62b87ac6d46070f55fd8 (patch)
tree3805e5763e0abeab6526d0e923f931f8f182524a
parentff45862ba44fee266467dcb9cf7e8d0fbe1d026a (diff)
downloadgitlab-ce-lazy-diffs.tar.gz
Explain why we have an 'overflow' statelazy-diffs
-rw-r--r--app/models/merge_request_diff.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 4bafc8df97e..df08d3a6dfb 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -143,9 +143,14 @@ class MergeRequestDiff < ActiveRecord::Base
else
diff_collection = unmerged_diffs
- self.state = :overflow if diff_collection.overflow?
+ if diff_collection.overflow?
+ # Set our state to 'overflow' to make the #empty? and #collected?
+ # methods (generated by StateMachine) return false.
+ self.state = :overflow
+ end
+
self.real_size = diff_collection.real_size
-
+
if diff_collection.any?
new_diffs = dump_diffs(diff_collection)
self.state = :collected