Skip to content

Gitlab::Diff::Line.match? can return false though type is "match"

The https://gitlab.com/gitlab-org/gitlab-ee/blob/master/lib/gitlab/diff/line.rb comes with this method:

def match?
  type == :match
end

However in our code base, we frequently provide the string "match" as type. In those cases, match? would return false. This is unexpected and may cause bugs.

Attempts to change this to check for both symbol and string has caused a few specs from other files to break.

Edited by Mark Chao