On Fri, 30 Oct 2015 10:59:49 -0700 (PDT)
Ivan Švaljek <ivan.sval...@gmail.com> wrote:
> Yes I would like to get the diff state in a C# program of mine, Git
> is one candidate if it's the easiest way to get such a state.
> Git is also a candidate because it has some merge functionality if
> I'm not wrong.
Well, you can leverage git for diffing, and it supports several diffing
algorythms of various properties (and respective sets of tradeoffs) but
you should be aware of certain things:
* Git's tools related to diffing and merging only work on objects
contained in a Git repository.
That is, to use these algos on arbitrary data you'd need to either
shovel such data to a Git repo or extract those algos from the Git
source code and re-write them in C#.
* Your notion of "destructiveness" is *very* specific to your particular
task. Sure, no generic tool such as Git does not implement anything
even remotely resembling what you are after. Git is only smart about
fuzzy matching and ignoring whitespace changes (when told to do so).
Sure it knows nothing about CSS or any other textual data format.
Hence my personal opinion on this is that you will hardly be able to
leverage existing *generic* tools except for actually using them to
detect the changed lines of text; after that, you'd need to use your
custom logic to classify those changes. But that really is not that
simple: take CSS for instance -- it's not a line-wise but rather a
block-wise format with the complicated set of rules of how a block or a
declaration in it applies to the DOM. So IMO to *semantically* diff CSS
files you actually should have code which parses both complete versions
to abstract syntax trees and then compares them, not files.
And if you still think that a poor man's line-wise approach would be
"good enough", that's okay, and I think that there should exist
pure-.NET libraries implementing diffing algorythms for textual data.
So why not just use these assemblies instead of depending on a
hard-to-package external tool like Git?
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.