Run of fresh-releases for ruby-diffy

Merge these changes:

git pull https://janitor.debian.net/git/ruby-diffy fresh-releases/main
git pull https://janitor.debian.net/git/ruby-diffy fresh-releases/pristine-tar
git pull https://janitor.debian.net/git/ruby-diffy fresh-releases/upstream

Summary

Merged new upstream version: 3.4.0 (was: 3.3.0).

Diff

Branch: main

diff --git a/README.md b/README.md
index e471fa7..c4438e2 100644
--- a/README.md
+++ b/README.md
@@ -277,6 +277,15 @@ combined with the `:context` option.
       foo
      bar
 
+### `:ignore_crlf` when doing HTML compares
+
+You can make the HTML output ignore the CRLF by passing the `:ignore_crlf` option a truthy value.
+
+    >> puts Diffy::Diff.new(" foo\nbar\n", "foo\r\nbar\r\n", ignore_crlf: true).to_s(:html)
+      "<div class=\"diff\"></div>"
+
+
+
 Default Diff Options
 --------------------
 
diff --git a/debian/changelog b/debian/changelog
index 4a4b66b..53f53d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-ruby-diffy (3.3.0-2) UNRELEASED; urgency=medium
+ruby-diffy (3.4.0-1) UNRELEASED; urgency=medium
 
   * Use secure copyright file specification URI.
   * Use secure URI in Homepage field.
@@ -7,8 +7,9 @@ ruby-diffy (3.3.0-2) UNRELEASED; urgency=medium
   * Update watch file format version to 4.
   * Bump debhelper from old 12 to 13.
   * Update standards version to 4.5.1, no changes needed.
+  * New upstream release.
 
- -- Debian Janitor <janitor@jelmer.uk>  Sun, 03 May 2020 22:54:06 +0000
+ -- Debian Janitor <janitor@jelmer.uk>  Tue, 08 Mar 2022 13:16:54 -0000
 
 ruby-diffy (3.3.0-1) unstable; urgency=medium
 
diff --git a/debian/patches/01-fix_library_path.patch b/debian/patches/01-fix_library_path.patch
index a5dabde..83f6184 100644
--- a/debian/patches/01-fix_library_path.patch
+++ b/debian/patches/01-fix_library_path.patch
@@ -3,8 +3,10 @@ Author: Abhijith PA <abhijith@openmailbox.org>
 Forwarded: not-needed
 Last-Update: 2018-08-01
 
---- a/spec/diffy_spec.rb
-+++ b/spec/diffy_spec.rb
+Index: ruby-diffy/spec/diffy_spec.rb
+===================================================================
+--- ruby-diffy.orig/spec/diffy_spec.rb
++++ ruby-diffy/spec/diffy_spec.rb
 @@ -1,5 +1,5 @@
  require 'rspec'
 -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'diffy'))
@@ -12,8 +14,10 @@ Last-Update: 2018-08-01
  
  describe Diffy::Diff do
  
---- a/spec/demo_app.rb
-+++ b/spec/demo_app.rb
+Index: ruby-diffy/spec/demo_app.rb
+===================================================================
+--- ruby-diffy.orig/spec/demo_app.rb
++++ ruby-diffy/spec/demo_app.rb
 @@ -1,7 +1,7 @@
  require 'rubygems'
  require 'sinatra'
diff --git a/lib/diffy/diff.rb b/lib/diffy/diff.rb
index f041263..4e737c4 100644
--- a/lib/diffy/diff.rb
+++ b/lib/diffy/diff.rb
@@ -174,7 +174,7 @@ module Diffy
 
     # options pass to diff program
     def diff_options
-      Array(options[:context] ? "-U #{options[:context]}" : options[:diff])
+      Array(options[:context] ? "-U#{options[:context]}" : options[:diff])
     end
 
   end
diff --git a/lib/diffy/html_formatter.rb b/lib/diffy/html_formatter.rb
index a72ee64..9f50668 100644
--- a/lib/diffy/html_formatter.rb
+++ b/lib/diffy/html_formatter.rb
@@ -90,10 +90,14 @@ module Diffy
 
     def split_characters(chunk)
       chunk.gsub(/^./, '').each_line.map do |line|
-        chars = line.sub(/([\r\n]$)/, '').split('')
-        # add escaped newlines
-        chars << '\n'
-        chars.map{|chr| ERB::Util.h(chr) }
+        if @options[:ignore_crlf]
+          (line.chomp.split('') + ['\n']).map{|chr| ERB::Util.h(chr) }
+        else
+          chars = line.sub(/([\r\n]$)/, '').split('')
+          # add escaped newlines
+          chars << '\n'
+          chars.map{|chr| ERB::Util.h(chr) }
+        end
       end.flatten.join("\n") + "\n"
     end
 
diff --git a/lib/diffy/version.rb b/lib/diffy/version.rb
index b64c577..82d72ac 100644
--- a/lib/diffy/version.rb
+++ b/lib/diffy/version.rb
@@ -1,3 +1,3 @@
 module Diffy
-  VERSION = '3.3.0'
+  VERSION = '3.4.0'
 end
diff --git a/spec/diffy_spec.rb b/spec/diffy_spec.rb
index c84f8ab..551c6c7 100644
--- a/spec/diffy_spec.rb
+++ b/spec/diffy_spec.rb
@@ -503,6 +503,13 @@ baz
         expect(@diff.to_s(:html)).to eq(html)
       end
 
+      it "should treat unix vs windows newlines as same if option :ignore_crlf" do
+        @diff = Diffy::Diff.new("one\ntwo\nthree\n", "one\r\ntwo\r\nthree\r\n",
+                               ignore_crlf: true)
+        empty_diff = "<div class=\"diff\"></div>"
+        expect(@diff.to_s(:html)).to eq(empty_diff)
+      end
+
       describe 'with lines that include \n' do
         before do
           string1 = 'a\nb'"\n"

Branch: pristine-tar

diff --git a/ruby-diffy_3.4.0.orig.tar.gz.delta b/ruby-diffy_3.4.0.orig.tar.gz.delta
new file mode 100644
index 0000000..bad73f3
Binary files /dev/null and b/ruby-diffy_3.4.0.orig.tar.gz.delta differ
diff --git a/ruby-diffy_3.4.0.orig.tar.gz.id b/ruby-diffy_3.4.0.orig.tar.gz.id
new file mode 100644
index 0000000..3f0d034
--- /dev/null
+++ b/ruby-diffy_3.4.0.orig.tar.gz.id
@@ -0,0 +1 @@
+f18c19a9fb559069f1286f9d7971bec23d4b2843

Branch: upstream

Tag: upstream/3.4.0
diff --git a/README.md b/README.md
index e471fa7..c4438e2 100644
--- a/README.md
+++ b/README.md
@@ -277,6 +277,15 @@ combined with the `:context` option.
       foo
      bar
 
+### `:ignore_crlf` when doing HTML compares
+
+You can make the HTML output ignore the CRLF by passing the `:ignore_crlf` option a truthy value.
+
+    >> puts Diffy::Diff.new(" foo\nbar\n", "foo\r\nbar\r\n", ignore_crlf: true).to_s(:html)
+      "<div class=\"diff\"></div>"
+
+
+
 Default Diff Options
 --------------------
 
diff --git a/lib/diffy/diff.rb b/lib/diffy/diff.rb
index f041263..4e737c4 100644
--- a/lib/diffy/diff.rb
+++ b/lib/diffy/diff.rb
@@ -174,7 +174,7 @@ module Diffy
 
     # options pass to diff program
     def diff_options
-      Array(options[:context] ? "-U #{options[:context]}" : options[:diff])
+      Array(options[:context] ? "-U#{options[:context]}" : options[:diff])
     end
 
   end
diff --git a/lib/diffy/html_formatter.rb b/lib/diffy/html_formatter.rb
index a72ee64..9f50668 100644
--- a/lib/diffy/html_formatter.rb
+++ b/lib/diffy/html_formatter.rb
@@ -90,10 +90,14 @@ module Diffy
 
     def split_characters(chunk)
       chunk.gsub(/^./, '').each_line.map do |line|
-        chars = line.sub(/([\r\n]$)/, '').split('')
-        # add escaped newlines
-        chars << '\n'
-        chars.map{|chr| ERB::Util.h(chr) }
+        if @options[:ignore_crlf]
+          (line.chomp.split('') + ['\n']).map{|chr| ERB::Util.h(chr) }
+        else
+          chars = line.sub(/([\r\n]$)/, '').split('')
+          # add escaped newlines
+          chars << '\n'
+          chars.map{|chr| ERB::Util.h(chr) }
+        end
       end.flatten.join("\n") + "\n"
     end
 
diff --git a/lib/diffy/version.rb b/lib/diffy/version.rb
index b64c577..82d72ac 100644
--- a/lib/diffy/version.rb
+++ b/lib/diffy/version.rb
@@ -1,3 +1,3 @@
 module Diffy
-  VERSION = '3.3.0'
+  VERSION = '3.4.0'
 end
diff --git a/spec/diffy_spec.rb b/spec/diffy_spec.rb
index c84f8ab..551c6c7 100644
--- a/spec/diffy_spec.rb
+++ b/spec/diffy_spec.rb
@@ -503,6 +503,13 @@ baz
         expect(@diff.to_s(:html)).to eq(html)
       end
 
+      it "should treat unix vs windows newlines as same if option :ignore_crlf" do
+        @diff = Diffy::Diff.new("one\ntwo\nthree\n", "one\r\ntwo\r\nthree\r\n",
+                               ignore_crlf: true)
+        empty_diff = "<div class=\"diff\"></div>"
+        expect(@diff.to_s(:html)).to eq(empty_diff)
+      end
+
       describe 'with lines that include \n' do
         before do
           string1 = 'a\nb'"\n"

Publish Blockers

Resulting package

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases ruby-diffy

Lintian Result

Full worker log Full build log