diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-08-17 02:55:00 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2018-08-27 17:10:27 +0300 |
commit | a9c4dec537ba1f53d37d8d3a24799956f878327d (patch) | |
tree | ae03eb32baf8a7bf1a63ab812455071eef276c84 /app/models/diff_note.rb | |
parent | a0cfc1b65ec959e187a4297bcab0b494cbe52cce (diff) |
Backport Repository#keep_around changes from EE to CE
Diffstat (limited to 'app/models/diff_note.rb')
-rw-r--r-- | app/models/diff_note.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/models/diff_note.rb b/app/models/diff_note.rb index 58d949315e0..716cf6574d3 100644 --- a/app/models/diff_note.rb +++ b/app/models/diff_note.rb @@ -191,14 +191,18 @@ class DiffNote < Note end def keep_around_commits - project.repository.keep_around(self.original_position.base_sha) - project.repository.keep_around(self.original_position.start_sha) - project.repository.keep_around(self.original_position.head_sha) + shas = [ + self.original_position.base_sha, + self.original_position.start_sha, + self.original_position.head_sha + ] if self.position != self.original_position - project.repository.keep_around(self.position.base_sha) - project.repository.keep_around(self.position.start_sha) - project.repository.keep_around(self.position.head_sha) + shas << self.position.base_sha + shas << self.position.start_sha + shas << self.position.head_sha end + + project.repository.keep_around(*shas) end end |