Open john-peterson opened 1 month ago
Hi, thanks for you interest in making wiggle better. I tried your first example but with a "\n" at the end of each file, and it worked as you would like (which surprised me a little). I'll probably enhance wiggle to add a "\n" to the end of the file if there isn't one (and the file isn't empty).
I tried your second example and it behaves as you say, but if I use "-b" or "--ignore-blanks" then it does what you want.
Similarly the final example gives the found/expected content that you wanted if you use "-b".
But both examples from termux code do, as you say, give the unwanted conflict even if I specify "-b".
The reasoning is that wiggle sees that the patch adds lines where someone else added lines, and it cannot deduce which of the insertions should be first, and which should be second. You want to say that you don't care when one of the insertions is simply blank lines.
It probably makes sense to enhance "-b" to also ignore blank lines. I'll try to find time to work on that.
I've pushed a few changes to wiggle on github. The "-b" option should now do what you want. Please test and confirm.
unexpected new line in context
if a new line has appeared in the patch context since the patch was created the patch is not cleanly applied
there could be a flag to ignore this type of conflict instead of forcing a manual edit
proposed solution: compare the found and expected section. if the difference is only white space characters write the replacement without a conflict message
in this example i would like to use the replacement as it is without creating a conflict message that an extra new line is now in the context that was not there before
and again almost the same
this might be redundant
the actual problem is the same but i also introduce a harmless mistake of removing a space from indentation
the found and expected message is still correct with context unlike the actual conflict further down
the actual conflict
all the conflicts from these patches seemed to be caused by new white space in the context that i would like to ignore
unexpected new line in context
there was one empty line in the context when i patched it but now there are three.
this happens in two places but i show only one for brevity
the message context is stripped but it is correct about two new empty lines
same problem again
a conflict is generated because a new line has appeared in the context
in this case also the replacement would be fine there was no need to generate a conflict
the first line in the patch is an accidentally removed space but it is irrelevant to the problem
the found and expected message is incorrect in this case it should indicate the new line with context preferably not the first line of the patch context that contains nothing interesting