1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix ArgumentError in expand_tabs.rb

This fixes the following in my environment:

misc/expand_tabs.rb:29:in `=~': invalid byte sequence in US-ASCII (ArgumentError)

This switches from =~ to start_with? as a regular expression is
not actually needed here.
This commit is contained in:
Jeremy Evans 2019-08-25 12:53:15 -07:00
parent e496e96547
commit b4dfac2c12

View file

@ -24,9 +24,9 @@ class Git
# [0, 1, 4, ...]
def updated_lines(file)
lines = []
revs_pattern = /\A0{40} /
revs_pattern = ("0"*40) + " "
with_clean_env { IO.popen(['git', 'blame', '-l', '--', file], &:readlines) }.each_with_index do |line, index|
if revs_pattern =~ line
if line.b.start_with?(revs_pattern)
lines << index
end
end