# is there a canonical doc about how to deal with whitespace issues?

4 messages from 2018-06-08 to 2018-06-13. Participants: Robert P. J. Day, Derrick Stolee, Stefan Beller.
Thread: https://gitlist.dev/t/48674

## Robert P. J. Day, 2018-06-08 13:18

Subject: is there a canonical doc about how to deal with whitespace issues?
Message-ID: <alpine.LFD.2.21.1806080914520.20892@localhost.localdomain>
URL: https://gitlist.dev/e/alpine.LFD.2.21.1806080914520.20892%40localhost.localdomain

```

  for one of my courses, i wanted to write a section about the various
techniques for dealing with whitespace issues in git, so i started
making a list, things like:

  - running "git diff --check"
  - "git commit --cleanup=" possibilities
  - config options like core.{eol,safecrlf,autocrlf}
  - i'm sure there are client-side hooks that can be mentioned

etc, etc.

  has anyone ever written a doc that collects these things in one
place? if not, i guess i have to write one.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

```

## Derrick Stolee, 2018-06-08 17:15

Subject: Re: is there a canonical doc about how to deal with whitespace issues?
Message-ID: <b8801d73-71c4-15c8-4b29-8e4edb3faec9@gmail.com>
URL: https://gitlist.dev/e/b8801d73-71c4-15c8-4b29-8e4edb3faec9%40gmail.com
In-Reply-To: <alpine.LFD.2.21.1806080914520.20892@localhost.localdomain>

```
On 6/8/2018 9:18 AM, Robert P. J. Day wrote:
>    for one of my courses, i wanted to write a section about the various
> techniques for dealing with whitespace issues in git, so i started
> making a list, things like:
>
>    - running "git diff --check"
>    - "git commit --cleanup=" possibilities
>    - config options like core.{eol,safecrlf,autocrlf}
>    - i'm sure there are client-side hooks that can be mentioned
>
> etc, etc.
>
>    has anyone ever written a doc that collects these things in one
> place? if not, i guess i have to write one.
>
> rday
>

I don't know of a doc for whitespace issues, but the contributing guide 
on GitForWindows [1] recommends `git rebase --whitespace=fix`.

Thanks,
-Stolee

[1] 
https://github.com/git-for-windows/git/blob/master/CONTRIBUTING.md#polish-your-commits

```

## Stefan Beller, 2018-06-11 21:45

Subject: Re: is there a canonical doc about how to deal with whitespace issues?
Message-ID: <CAGZ79kazegY-udjKfbkfw=ox82cfxhO5E3AEjLKkSt3LMY-DFw@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kazegY-udjKfbkfw%3Dox82cfxhO5E3AEjLKkSt3LMY-DFw%40mail.gmail.com
In-Reply-To: <b8801d73-71c4-15c8-4b29-8e4edb3faec9@gmail.com>

```
On Fri, Jun 8, 2018 at 10:15 AM Derrick Stolee <stolee@gmail.com> wrote:
>
> On 6/8/2018 9:18 AM, Robert P. J. Day wrote:
> >    for one of my courses, i wanted to write a section about the various
> > techniques for dealing with whitespace issues in git, so i started

What do you mean by white space issues?
That in itself is a complex topic:
* There are 3 different modes to ignore white space changes:
  - trailing whitespaces,
  - conversion of tab to space and back
    These two are caught by the default in 'git diff --check'
  - any white space change
    This is interesting to ignore in git-blame[1], but sometimes
    it is actually interesting.

[1] See also
https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html



> > making a list, things like:
> >
> >    - running "git diff --check"
> >    - "git commit --cleanup=" possibilities
> >    - config options like core.{eol,safecrlf,autocrlf}

This sounds more like line ending or cross platform issues
than whitespaces (except .eol)

> >    - i'm sure there are client-side hooks that can be mentioned

Personally I use the defaults when contributing to git.git
and have an editor setting that removes trailing white spaces.

That has served me well so far; the only time I was bitten by
white spaces is when sending patches using an email client
other than git-send-email as the white spaces might get mangled
there.

Is sending patches by email part of your course?

```

## Robert P. J. Day, 2018-06-13 12:26

Subject: Re: is there a canonical doc about how to deal with whitespace issues?
Message-ID: <alpine.LFD.2.21.1806130824110.12332@localhost.localdomain>
URL: https://gitlist.dev/e/alpine.LFD.2.21.1806130824110.12332%40localhost.localdomain
In-Reply-To: <CAGZ79kazegY-udjKfbkfw=ox82cfxhO5E3AEjLKkSt3LMY-DFw@mail.gmail.com>

```
On Mon, 11 Jun 2018, Stefan Beller wrote:

> On Fri, Jun 8, 2018 at 10:15 AM Derrick Stolee <stolee@gmail.com> wrote:
> >
> > On 6/8/2018 9:18 AM, Robert P. J. Day wrote:
> > >    for one of my courses, i wanted to write a section about the
> > > various techniques for dealing with whitespace issues in git, so
> > > i started
>
> What do you mean by white space issues?
> That in itself is a complex topic:

  i know ... it's not even clear that just dealing with EOL
standardization shouldn't be a topic all by itself.

> * There are 3 different modes to ignore white space changes:
>   - trailing whitespaces,
>   - conversion of tab to space and back
>     These two are caught by the default in 'git diff --check'
>   - any white space change
>     This is interesting to ignore in git-blame[1], but sometimes
>     it is actually interesting.
>
> [1] See also
> https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html
>
>
>
> > > making a list, things like:
> > >
> > >    - running "git diff --check"
> > >    - "git commit --cleanup=" possibilities
> > >    - config options like core.{eol,safecrlf,autocrlf}
>
> This sounds more like line ending or cross platform issues
> than whitespaces (except .eol)

  i just started a quick-and-dirty wiki page as a reference to things
that relate to whitespace:

  http://crashcourse.ca/dokuwiki/doku.php?id=git_whitespace

it's not even *remotely* close to comprehensive, i just wanted to
start making a list. feel free to make other suggestions as i keep
adding to that page.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

```
