I have a requirement to style only the part of the C/C++ file which is getting committed (so the blame for the other lines are intact). Is there any tool to just do that? I know we can style the whole file and get the blame to ignore styling changes (but my team doesn't want that).
Here are a few things I tried with astyle:
I write the diff to a new file and style it and replace the diff part in the original file - Why it doesn't work? It doesn't really get styled as it doesn't have the context, like the if statement to indent the rest of the lines on etc.
I style the whole file and replace only the section that changed. - Why it doesn't work? If I try to change max code length and the lines get broken up then the diff lines are different.
How about a 3 way merge between the original file and the file where the styled diff is included? Yet to try this.
May be there is an easier way and I am missing it :S