# white spaces in a patch

12 messages from 2008-12-17 to 2008-12-17. Participants: Mark Ryden, Junio C Hamano, Johannes Schindelin, Thomas Jarosch, Sverre Rabbelier, Jeff King, Matthieu Moy.
Thread: https://gitlist.dev/t/16762

## Mark Ryden, 2008-12-17 07:31

Subject: white spaces in a patch
Message-ID: <dac45060812162331k19272488r4e95e0555e7a6db9@mail.gmail.com>
URL: https://gitlist.dev/e/dac45060812162331k19272488r4e95e0555e7a6db9%40mail.gmail.com

```
Hello,

It occurred to me that I prepared some patch for a git tree, and
then when testing git-apply on it (on the original tree) I saw
some "white spaces" errors.
I know that I can run:
"git --whitespace=fix apply" on my patch and than create the patch
again ; in this way it will be created without white spaces.

Suppose I create a patch file (let's say : patch.txt)
1) Is there a way to check whether there are white spaces in this
file without running git-apply?
2) Is there a way to get some messages about that there are white spaces
when creating a git patch?

Regards,
Mark

```

## Junio C Hamano, 2008-12-17 07:34

Subject: Re: white spaces in a patch
Message-ID: <7vej07p84i.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vej07p84i.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <dac45060812162331k19272488r4e95e0555e7a6db9@mail.gmail.com>

```
"Mark Ryden" <markryde@gmail.com> writes:

> 1) Is there a way to check whether there are white spaces in this
> file without running git-apply?

"sed -n -e '/^+.*[ 	]$/p' patch.txt" perhaps?

> 2) Is there a way to get some messages about that there are white spaces
> when creating a git patch?

Doesn't "git diff" highlight whitespace errors?  That way, you can catch
errors  before you make a commit that has them.

```

## Mark Ryden, 2008-12-17 11:44

Subject: Re: white spaces in a patch
Message-ID: <dac45060812170344u368ffd7fx4e86253b4a13ffc7@mail.gmail.com>
URL: https://gitlist.dev/e/dac45060812170344u368ffd7fx4e86253b4a13ffc7%40mail.gmail.com
In-Reply-To: <7vej07p84i.fsf@gitster.siamese.dyndns.org>

```
Hello,

I tried:
git apply patch1.txt
patch1.txt:34: trailing whitespace.
				
patch1.txt:53: trailing whitespace.

And
"git diff"  show differences but **does not**
highlight anything.
I tried in tchs and in Bash.

Any ideas ? does "git diff" does  highlight for anyone ?

Rgs,
Mark


On Wed, Dec 17, 2008 at 9:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
> "Mark Ryden" <markryde@gmail.com> writes:
>
>> 1) Is there a way to check whether there are white spaces in this
>> file without running git-apply?
>
> "sed -n -e '/^+.*[      ]$/p' patch.txt" perhaps?
>
>> 2) Is there a way to get some messages about that there are white spaces
>> when creating a git patch?
>
> Doesn't "git diff" highlight whitespace errors?  That way, you can catch
> errors  before you make a commit that has them.
>

```

## Johannes Schindelin, 2008-12-17 12:08

Subject: Re: white spaces in a patch
Message-ID: <alpine.DEB.1.00.0812171307460.28560@intel-tinevez-2-302>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0812171307460.28560%40intel-tinevez-2-302
In-Reply-To: <7vej07p84i.fsf@gitster.siamese.dyndns.org>

```
Hi,

On Tue, 16 Dec 2008, Junio C Hamano wrote:

> "Mark Ryden" <markryde@gmail.com> writes:
> 
> > 2) Is there a way to get some messages about that there are white 
> >    spaces when creating a git patch?
> 
> Doesn't "git diff" highlight whitespace errors?  That way, you can catch 
> errors before you make a commit that has them.

Not to mention "git diff --check", which should catch them, too.

Ciao,
Dscho

```

## Mark Ryden, 2008-12-17 12:10

Subject: Re: white spaces in a patch
Message-ID: <dac45060812170410h20e710b0ted10d46b9b96ac9d@mail.gmail.com>
URL: https://gitlist.dev/e/dac45060812170410h20e710b0ted10d46b9b96ac9d%40mail.gmail.com
In-Reply-To: <alpine.DEB.1.00.0812171307460.28560@intel-tinevez-2-302>

```
Hello,
Thanks!

"git diff --check" indeed tells about trailing whitespace
Mark

On Wed, Dec 17, 2008 at 2:08 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Tue, 16 Dec 2008, Junio C Hamano wrote:
>
>> "Mark Ryden" <markryde@gmail.com> writes:
>>
>> > 2) Is there a way to get some messages about that there are white
>> >    spaces when creating a git patch?
>>
>> Doesn't "git diff" highlight whitespace errors?  That way, you can catch
>> errors before you make a commit that has them.
>
> Not to mention "git diff --check", which should catch them, too.
>
> Ciao,
> Dscho
>
>

```

## Sverre Rabbelier, 2008-12-17 12:13

Subject: Re: white spaces in a patch
Message-ID: <bd6139dc0812170413j5ed2d9eak89df8517bc91c5fd@mail.gmail.com>
URL: https://gitlist.dev/e/bd6139dc0812170413j5ed2d9eak89df8517bc91c5fd%40mail.gmail.com
In-Reply-To: <dac45060812170344u368ffd7fx4e86253b4a13ffc7@mail.gmail.com>

```
On Wed, Dec 17, 2008 at 12:44, Mark Ryden <markryde@gmail.com> wrote:
> Any ideas ? does "git diff" does  highlight for anyone ?

Do you have color on?

-- 
Cheers,

Sverre Rabbelier

```

## Mark Ryden, 2008-12-17 12:13

Subject: Re: white spaces in a patch
Message-ID: <dac45060812170413w7c8cffaifa1a0f3b649474e4@mail.gmail.com>
URL: https://gitlist.dev/e/dac45060812170413w7c8cffaifa1a0f3b649474e4%40mail.gmail.com
In-Reply-To: <bd6139dc0812170413j5ed2d9eak89df8517bc91c5fd@mail.gmail.com>

```
What do you mean ?
where ? how ?
Mark

On Wed, Dec 17, 2008 at 2:13 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:
> On Wed, Dec 17, 2008 at 12:44, Mark Ryden <markryde@gmail.com> wrote:
>> Any ideas ? does "git diff" does  highlight for anyone ?
>
> Do you have color on?
>
> --
> Cheers,
>
> Sverre Rabbelier
>

```

## Thomas Jarosch, 2008-12-17 12:15

Subject: Re: white spaces in a patch
Message-ID: <200812171316.21531.thomas.jarosch@intra2net.com>
URL: https://gitlist.dev/e/200812171316.21531.thomas.jarosch%40intra2net.com
In-Reply-To: <dac45060812170413w7c8cffaifa1a0f3b649474e4@mail.gmail.com>

```
On Wednesday, 17. December 2008 13:13:34 Mark Ryden wrote:
[colors in diff]
> What do you mean ?
> where ? how ?

This should do the trick:

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto

Thomas

```

## Sverre Rabbelier, 2008-12-17 12:16

Subject: Re: white spaces in a patch
Message-ID: <bd6139dc0812170416w5e2cc537v6143b6071f9b8225@mail.gmail.com>
URL: https://gitlist.dev/e/bd6139dc0812170416w5e2cc537v6143b6071f9b8225%40mail.gmail.com
In-Reply-To: <dac45060812170413w7c8cffaifa1a0f3b649474e4@mail.gmail.com>

```
On Wed, Dec 17, 2008 at 13:13, Mark Ryden <markryde@gmail.com> wrote:
> On Wed, Dec 17, 2008 at 2:13 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:
>> Do you have color on?

$ git config color.diff true


-- 
Cheers,

Sverre Rabbelier

```

## Mark Ryden, 2008-12-17 12:22

Subject: Re: white spaces in a patch
Message-ID: <dac45060812170422yc259d39vd1b198c1530a40a5@mail.gmail.com>
URL: https://gitlist.dev/e/dac45060812170422yc259d39vd1b198c1530a40a5%40mail.gmail.com
In-Reply-To: <200812171316.21531.thomas.jarosch@intra2net.com>

```
Thnks!
In fact, the first line was enough!
git config --global color.diff auto
Mark



On Wed, Dec 17, 2008 at 2:15 PM, Thomas Jarosch
<thomas.jarosch@intra2net.com> wrote:
> On Wednesday, 17. December 2008 13:13:34 Mark Ryden wrote:
> [colors in diff]
>> What do you mean ?
>> where ? how ?
>
> This should do the trick:
>
> git config --global color.diff auto
> git config --global color.status auto
> git config --global color.branch auto
>
> Thomas
>
>

```

## Jeff King, 2008-12-17 12:22

Subject: Re: white spaces in a patch
Message-ID: <20081217122240.GA14342@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20081217122240.GA14342%40coredump.intra.peff.net
In-Reply-To: <200812171316.21531.thomas.jarosch@intra2net.com>

```
On Wed, Dec 17, 2008 at 01:15:56PM +0100, Thomas Jarosch wrote:

> This should do the trick:
> 
> git config --global color.diff auto
> git config --global color.status auto
> git config --global color.branch auto

These days we have

  git config --global color.ui auto

-Peff

```

## Matthieu Moy, 2008-12-17 20:02

Subject: Re: white spaces in a patch
Message-ID: <vpqljuelgd0.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqljuelgd0.fsf%40bauges.imag.fr
In-Reply-To: <dac45060812170422yc259d39vd1b198c1530a40a5@mail.gmail.com>

```
"Mark Ryden" <markryde@gmail.com> writes:

> Thnks!
> In fact, the first line was enough!
> git config --global color.diff auto

Yes, but you may appreciate color in other commands (log,
status, ...).  Then, "color.ui = auto" is your friend.

-- 
Matthieu

```
