2 ms·
A diff like this is perfectly valid: -foo -bar -baz +foo +bar Although I don't know any tool which would actually generate such a diff.
by jstanley 3y ago
A diff like this is perfectly valid:
-foo
-bar
-baz
+foo
+bar
Although I don't know any tool which would actually generate such a diff.
- hunter2_ 3y agoOh! I was keeping my thoughts scoped to the output of existing tools. Beyond that doesn't seem worth considering in this particular context.
- seba_dos1 3y agoThe existing tools already let you choose the algorithm used to generate the diff, so it's not a big stretch to imagine an algorithm that may do just this. It doesn't make much sense for such 1 line example (although it could if you had, say, an algorithm that considers whole paragraphs, or blocks in some programming language, rather than lines - could be useful for line art perhaps), but with more complex changes there won't be a single "optimal" representation, especially when what's "optimal" depends on what you want to optimize for.