lib/gitlab_git/diff.rb in gitlab_git-9.0.1 vs lib/gitlab_git/diff.rb in gitlab_git-9.0.2
- old
+ new
@@ -7,11 +7,11 @@
# Diff properties
attr_accessor :old_path, :new_path, :a_mode, :b_mode, :diff
# Stats properties
- attr_accessor :new_file, :renamed_file, :deleted_file
+ attr_accessor :new_file, :renamed_file, :deleted_file
class << self
def between(repo, head, base, options = {}, *paths)
# Only show what is new in the source branch compared to the target branch, not the other way around.
# The linex below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
@@ -167,11 +167,11 @@
raise "Invalid raw diff type: #{raw_diff.class}"
end
end
def serialize_keys
- @serialize_keys ||= %w(diff new_path old_path a_mode b_mode new_file renamed_file deleted_file).map(&:to_sym)
+ @serialize_keys ||= %i(diff new_path old_path a_mode b_mode new_file renamed_file deleted_file)
end
def to_hash
hash = {}
@@ -220,10 +220,10 @@
def strip_diff_headers(diff_text)
# Delete everything up to the first line that starts with '---' or
# 'Binary'
diff_text.sub!(/\A.*?^(---|Binary)/m, '\1')
- if diff_text.start_with?('---') or diff_text.start_with?('Binary')
+ if diff_text.start_with?('---', 'Binary')
diff_text
else
# If the diff_text did not contain a line starting with '---' or
# 'Binary', return the empty string. No idea why; we are just
# preserving behavior from before the refactor.