diffy icon indicating copy to clipboard operation
diffy copied to clipboard

Allow diff command to be overriden

Open aptituz opened this issue 10 years ago • 4 comments

Since different diff implementation support different feature sets (e.g. BSD find vs. GNU find), it would be helpful if one could chose which find binary is used. Could this feature be added?

aptituz avatar Oct 16 '15 06:10 aptituz

I'd definitely be open to a pull request if someone would create one. It seems like a useful feature, though I won't have time to work on it myself in the near future.

samg avatar Oct 25 '15 04:10 samg

We constantly have trouble with the external diff command, as it depends on user's installation which in big companies is not under full control of the user :-)

Would it be possible to have a mode which does not use an external diff command but integrates the code from lcs-diff ldiff?

bwl21 avatar May 20 '17 07:05 bwl21

@bwl21 I think you suggestion is definitely possible. I considered doing this when I initially wrote diffy but found it was more straightforward to solve the problem by using diff. (Using diff-lcs seemed like it'd require reimplementing a lot of the text output aspects that diff provides)

Looking back through the source code it is possible to override the diff command used via an ENV['DIFFY_DIFF'] (though this doesn't seem to be documented anywhere outside the source and may not fully solve the issues raised in this ticket). https://github.com/samg/diffy/blob/master/lib/diffy/diff.rb#L147

samg avatar May 21 '17 04:05 samg

@samg I investigated the sources of diffy and discovered ENV[DIFFY_DIFF]. In our project, we have rake tasks to compare sets of doucuments. In this tasks we using indeed ENV['DIFFY_DIFF'] to point to a ldiff command which is provided by diff-lcs. Even if weset DIFFY_DIFF to the full path of ldiff.bat, for whatever reason (we still investigate why), it does not work in all cases.

Further on it opens another ruby sub process which is again somehow slow (it takes about 1 sec).

Therefore, we search for a better Integration which does not use a subprocess.

bwl21 avatar May 21 '17 09:05 bwl21