by chriswarbo · 6y ago · 0 comments
-def foo()
-{
+def bar()
+{
+ doBarThing;
- doFooThing;
}
There are many ways to represent the same diff, but this sort of half-and-half result happens so often, and is such a minor problem, that it's usually not worth bothering to fix when committing. Yet it's the sort of weird input that can complicate later merges, cherry-picking, etc.A semantic-aware diff could do better. Again, there are many ways to represent the diff, but it could be as fine-grained as the token-level, e.g.
def -foo+bar()
{
-doFooThing+doBarThing;
}
Or as coarse-grained as the definition level, e.g. -def foo()
-{
- doFooThing;
-}
+def bar()
+{
+ doBarThing;
+}
Either way (or something in-between), these represent more meaningful changes, and hence provide more useful input to subsequent processing (e.g. merging).