[Dnsmasq-discuss] space two point eighty one

Mark Grant m.grant.prg at gmail.com
Sat Mar 7 08:50:21 GMT 2020



On Fri, 6 Mar 2020 23:38:46 +0100, Geert Stappers wrote:

> On Fri, Mar 06, 2020 at 02:53:43PM +0000, Mark Grant wrote:
> > On Thu, 5 Mar 2020 22:34:29 +0000, Simon Kelley wrote:  
> > > On 05/03/2020 21:05, Geert Stappers wrote:  
> > > > On Thu, Mar 05, 2020 at 09:46:21PM +0100, Geert Stappers
> > > > wrote:    
> > > >>>   ...  
> > > >>
> > > >> I plea for removal of unneeded ' ' and '	'.
> > > >>
> > > >> That removal can be done with:
> > > >>
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc    
> > > > 
> > > > Numbers from output of `wc` increased.
> > > > 
> > > >     
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc
> > > >> sed --in-place -e '${/^ *$/d;}' src/*.c ; git diff | wc    
> > > > 
> > > > Output of `wc` is stable.
> > > > 
> > > > At this point you probably want to do `git diff`
> > > > and will see that trailing-space-only-lines are removed.
> > > > 
> > > >     
> > > >> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc    
> > > > 
> > > > Lines that had only spaces or tabs got that white space removed.
> > > > 
> > > >      
> > > >> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc
> > > >> sed --in-place -e 's/^[ \t]*$//' src/*.c ; git diff | wc    
> > > > 
> > > > Output of `wc` is stable.
> > > > 
> > > > `git diff` is huge, almost 22000 lines.  Yes, a huge clean-up.  
> 
> | $ git diff | wc
> | 21782   77039  600247
> 
> That 21782  became the "almost 22000 lines"
> 
> > > > 
> > > > I love to see that in the 2.81 release of dnsmasq.
> > > > 
> > > >  git commit -am "Removed useless whitespace" --author "Geert
> > > > Stappers <stappers at stappers.nl>"
> > > > 
> > > >     
> > > 
> > > The obvious problem with doing that is that for ever more, when I
> > > run "git blame" 22000 lines will have the source "Removed useless
> > > whitespace".  
> 
> Euh `git diff` has "context".
> Better numbers in another email.
> 
> > > I have a feeling someone once posted a solution to that, but I
> > > don't have time to trawl back and find it. Can anyone help?
> > >   
> > Does
> >   git blame -w
> > do the trick?
> > 
> > Mark  
> 
> stappers at paddy:~/src/dnsmasq
> $ git blame -w src/arp.c | head -n 15
> 2a8710ac (Simon Kelley 2020-01-05 16:40:06 +0000   1) /* dnsmasq is
> Copyright (c) 2000-2020 Simon Kelley 11867dc2 (Simon Kelley
> 2015-12-23 16:15:58 +0000   2) 11867dc2 (Simon Kelley 2015-12-23
> 16:15:58 +0000   3)    This program is free software; you can
> redistribute it and/or modify 11867dc2 (Simon Kelley 2015-12-23
> 16:15:58 +0000   4)    it under the terms of the GNU General Public
> License as published by 11867dc2 (Simon Kelley 2015-12-23 16:15:58
> +0000   5)    the Free Software Foundation; version 2 dated June,
> 1991, or 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000   6)    (at
> your option) version 3 dated 29 June, 2007. 11867dc2 (Simon Kelley
> 2015-12-23 16:15:58 +0000   7) 11867dc2 (Simon Kelley 2015-12-23
> 16:15:58 +0000   8)    This program is distributed in the hope that
> it will be useful, 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000
> 9)    but WITHOUT ANY WARRANTY; without even the implied warranty of
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000  10)
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000  11)    GNU General
> Public License for more details. 11867dc2 (Simon Kelley 2015-12-23
> 16:15:58 +0000  12) 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000
> 13)    You should have received a copy of the GNU General Public
> License 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000  14)
> along with this program.  If not, see <http://www.gnu.org/licenses/>.
> 11867dc2 (Simon Kelley 2015-12-23 16:15:58 +0000  15) */
> stappers at paddy:~/src/dnsmasq $ git blame src/arp.c | head -n 15
> 2a8710ac (Simon Kelley   2020-01-05 16:40:06 +0000   1) /* dnsmasq is
> Copyright (c) 2000-2020 Simon Kelley 11867dc2 (Simon Kelley
> 2015-12-23 16:15:58 +0000   2) 11867dc2 (Simon Kelley   2015-12-23
> 16:15:58 +0000   3)    This program is free software; you can
> redistribute it and/or modify 11867dc2 (Simon Kelley   2015-12-23
> 16:15:58 +0000   4)    it under the terms of the GNU General Public
> License as published by 11867dc2 (Simon Kelley   2015-12-23 16:15:58
> +0000   5)    the Free Software Foundation; version 2 dated June,
> 1991, or 11867dc2 (Simon Kelley   2015-12-23 16:15:58 +0000   6)
> (at your option) version 3 dated 29 June, 2007. e0984534 (Geert
> Stappers 2020-03-06 23:12:53 +0100   7) 11867dc2 (Simon Kelley
> 2015-12-23 16:15:58 +0000   8)    This program is distributed in the
> hope that it will be useful, 11867dc2 (Simon Kelley   2015-12-23
> 16:15:58 +0000   9)    but WITHOUT ANY WARRANTY; without even the
> implied warranty of 11867dc2 (Simon Kelley   2015-12-23 16:15:58
> +0000  10)    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> See the 11867dc2 (Simon Kelley   2015-12-23 16:15:58 +0000  11)
> GNU General Public License for more details. e0984534 (Geert Stappers
> 2020-03-06 23:12:53 +0100  12) 11867dc2 (Simon Kelley   2015-12-23
> 16:15:58 +0000  13)    You should have received a copy of the GNU
> General Public License 11867dc2 (Simon Kelley   2015-12-23 16:15:58
> +0000  14)    along with this program.  If not, see
> <http://www.gnu.org/licenses/>. 11867dc2 (Simon Kelley   2015-12-23
> 16:15:58 +0000  15) */ stappers at paddy:~/src/dnsmasq $ 
> 
> 
> Regards
> Geert Stappers

Thanks. So lines 7 & 12 show the desired behaviour (ignoring
whitespace-only changes).

AFAICS there is no mechanism to make this the default behaviour within
git. A shell alias?

Regards,
Mark



More information about the Dnsmasq-discuss mailing list