Update upstream source from tag 'upstream/3.4.2'
Update to upstream version '3.4.2'
with Debian dir 4cc283d6f9137aebfd0731b272b3785f7c0fa02a
Vinay Keshava
1 year, 6 months ago
|
0 |
== 3.4.2 ==
|
|
1 |
Silence warning from unused variable when using `ruby -w`. Thanks
|
|
2 |
@sambostock!
|
|
3 |
|
|
4 |
== 3.4.1 ==
|
|
5 |
Prevent remote code execution from user controlled diff file paths. This
|
|
6 |
issue was only present in Windows platforms. Thanks @tehryanx for reporting
|
|
7 |
and testing the fix!
|
|
8 |
|
|
9 |
== 3.4.0 ==
|
|
10 |
Remove space between U diff option and context number. Thanks @tomas!
|
|
11 |
Add option to ignore CRLF diffs in HTML comparisons. Thanks @ptyagi16!
|
|
12 |
|
0 | 13 |
== 3.3.0 ==
|
1 | 14 |
Fix diff lines that begin with -- or ++. Thanks @dark-panda!
|
2 | 15 |
|
276 | 276 |
foo
|
277 | 277 |
bar
|
278 | 278 |
|
|
279 |
### `:ignore_crlf` when doing HTML compares
|
|
280 |
|
|
281 |
You can make the HTML output ignore the CRLF by passing the `:ignore_crlf` option a truthy value.
|
|
282 |
|
|
283 |
>> puts Diffy::Diff.new(" foo\nbar\n", "foo\r\nbar\r\n", ignore_crlf: true).to_s(:html)
|
|
284 |
"<div class=\"diff\"></div>"
|
|
285 |
|
|
286 |
|
|
287 |
|
279 | 288 |
Default Diff Options
|
280 | 289 |
--------------------
|
281 | 290 |
|
48 | 48 |
[string1, string2]
|
49 | 49 |
end
|
50 | 50 |
|
51 | |
if WINDOWS
|
52 | |
# don't use open3 on windows
|
53 | |
cmd = sprintf '"%s" %s %s', diff_bin, diff_options.join(' '), @paths.map { |s| %("#{s}") }.join(' ')
|
54 | |
diff = `#{cmd}`
|
55 | |
else
|
56 | |
diff = Open3.popen3(diff_bin, *(diff_options + @paths)) { |i, o, e| o.read }
|
57 | |
end
|
|
51 |
diff, _stderr, _process_status = Open3.capture3(diff_bin, *(diff_options + @paths))
|
58 | 52 |
diff.force_encoding('ASCII-8BIT') if diff.respond_to?(:valid_encoding?) && !diff.valid_encoding?
|
59 | 53 |
if diff =~ /\A\s*\Z/ && !options[:allow_empty_diff]
|
60 | 54 |
diff = case options[:source]
|
|
173 | 167 |
|
174 | 168 |
# options pass to diff program
|
175 | 169 |
def diff_options
|
176 | |
Array(options[:context] ? "-U #{options[:context]}" : options[:diff])
|
|
170 |
Array(options[:context] ? "-U#{options[:context]}" : options[:diff])
|
177 | 171 |
end
|
178 | 172 |
|
179 | 173 |
end
|
89 | 89 |
|
90 | 90 |
def split_characters(chunk)
|
91 | 91 |
chunk.gsub(/^./, '').each_line.map do |line|
|
92 | |
chars = line.sub(/([\r\n]$)/, '').split('')
|
93 | |
# add escaped newlines
|
94 | |
chars << '\n'
|
95 | |
chars.map{|chr| ERB::Util.h(chr) }
|
|
92 |
if @options[:ignore_crlf]
|
|
93 |
(line.chomp.split('') + ['\n']).map{|chr| ERB::Util.h(chr) }
|
|
94 |
else
|
|
95 |
chars = line.sub(/([\r\n]$)/, '').split('')
|
|
96 |
# add escaped newlines
|
|
97 |
chars << '\n'
|
|
98 |
chars.map{|chr| ERB::Util.h(chr) }
|
|
99 |
end
|
96 | 100 |
end.flatten.join("\n") + "\n"
|
97 | 101 |
end
|
98 | 102 |
|
0 | 0 |
module Diffy
|
1 | |
VERSION = '3.3.0'
|
|
1 |
VERSION = '3.4.2'
|
2 | 2 |
end
|
502 | 502 |
expect(@diff.to_s(:html)).to eq(html)
|
503 | 503 |
end
|
504 | 504 |
|
|
505 |
it "should treat unix vs windows newlines as same if option :ignore_crlf" do
|
|
506 |
@diff = Diffy::Diff.new("one\ntwo\nthree\n", "one\r\ntwo\r\nthree\r\n",
|
|
507 |
ignore_crlf: true)
|
|
508 |
empty_diff = "<div class=\"diff\"></div>"
|
|
509 |
expect(@diff.to_s(:html)).to eq(empty_diff)
|
|
510 |
end
|
|
511 |
|
505 | 512 |
describe 'with lines that include \n' do
|
506 | 513 |
before do
|
507 | 514 |
string1 = 'a\nb'"\n"
|