Reputation: 73
Is there anyway to ignore style changes made by the Eclipse code formatting (Eg new lines, bracket style, etc), right now it just create a bunch of unnecessary stuff in my patch file.
Using the command diff -ur original modified > source.diff
Update: Sample input and desired output
The original code looks like:
private void sampleFunction()
{
// Code
}
But after i've used Eclipse, it looks like:
private void sampleFunction() {
// Code
}
And when using diff, it will include this. Is there any way to make it ignore this ?
Upvotes: 3
Views: 701
Reputation: 3821
There is no way to ignore style changes by any diff program, because diff never has semantic information about the files you compare!
The correct solution would be to configure the eclipse formatter (you could have more than one format!) so that it results in (nearly) the same style as the original one.
But possibly it is more simple to fix your problem by switching off eclipses automatic formatting on save action:
This should leave the formatting untouched as long as you are not doing a formatting manually (by context menu/source/formatting) or by using ctrl+shift+f
.
Upvotes: 1