Re: [RFC patch net/next] net: Hoist assigns from if?

Eric Dumazet
2010-06-15T05:42:10Z

Le lundi 14 juin 2010 à 17:20 -0700, Joe Perches a écrit :
> Awhile back I posted a script to reformat source code,
> similar to Lindent, but able to select in a piecemeal
> manner what source code style to convert.
>
> http://lkml.org/lkml/2010/3/24/447
>
> One of the options is to convert code from:
> if ((err = function(args)) != NULL) {
> to:
> err = function(args);
> if (err != NULL) {
>
> I ran this script against net/ and get this result:
>
> $ grep -rPl --include=*.[ch] "\bif\s*\(\s*\(" net/ | \
> grep -v netfilter | \
> xargs ./scripts/cvt_kernel_style.pl -o -convert=hoist_assigns_from_if
>
> and after a little cleanup, compilation verification, etc
> I get the diffstat below. Should I post the actual patch?
>

I'll answer for myself, but wait for David answer ;)

Quite honestly, this kind of patch sucks, because it pollutes 'git
blame' output. Its hard to point out the origin of a particular
bug/code, and we have to spend precious time playing with complex git
commands to go over cleanup patches.

Maybe its possible to mark a patch with a 'cleanups only' git qualifier
that can be ignored by 'git blame' ?

If not, that would be a nice git improvement to work on.

Alternatively, you could change real old stuff only (marked as the
original commit from Linus (1da177e4c3f4), creation of the known
universe back in 2005.