diffy icon indicating copy to clipboard operation
diffy copied to clipboard

Doesn't work when :diff is specified as empty string

Open Ocado-NickBrown opened this issue 11 years ago • 1 comments

I have two files A, B with a handful of differing lines.

If I do:

puts Diffy::Diff.new(A, B, {:source => 'files'}).to_s

It gives me the output of bash command diff -U 10000 A B as expected.

If I instead do

puts Diffy::Diff.new(A, B, {:diff => '', :source => 'files'}).to_s

It gives me no output at all, whereas bash command diff A B gives me the minimal output I'm looking for i.e. just the changed lines.

Can you please explain why this doesn't work?

Ocado-NickBrown avatar Aug 07 '14 13:08 Ocado-NickBrown

Also, if I try to achieve the same thing with:

puts Diffy::Diff.new(A, B, {:context => 0, :source => 'files'}).to_s

..it removes the patch-critical line references when compared to the same output done in bash via diff -U 0 A B.

I thought this API is supposed to "get out of my way"? I may as well just wrap the CLI version at this rate! :-)

Ocado-NickBrown avatar Aug 07 '14 13:08 Ocado-NickBrown