diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-10 23:17:47 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-04-10 23:17:52 +0300 |
commit | 4f8c36c03c0f0aebc3956fa530f1b78ae3c76fc0 (patch) | |
tree | 0f1bfe3e51bf1e72ecc537b07173b504f5bb6940 /app/models/merge_request_diff.rb | |
parent | 48a0e9f6aece36e83e3ffde5be42f964b5362221 (diff) |
Add specs
Diffstat (limited to 'app/models/merge_request_diff.rb')
-rw-r--r-- | app/models/merge_request_diff.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 0143dd83501..08066db4767 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -134,6 +134,18 @@ class MergeRequestDiff < ActiveRecord::Base st_commits.map { |commit| commit[:id] } end + def diff_refs=(new_diff_refs) + if new_diff_refs + self.base_commit_sha = new_diff_refs.base_sha + self.start_commit_sha = new_diff_refs.start_sha + self.head_commit_sha = new_diff_refs.head_sha + else + self.base_commit_sha = nil + self.start_commit_sha = nil + self.head_commit_sha = nil + end + end + def diff_refs return unless start_commit_sha || base_commit_sha |