# trailling whitespace with git am ?

5 messages from 2009-08-14 to 2009-08-14. Participants: PICCA Frédéric-Emmanuel, Alex Riesen, Junio C Hamano.
Thread: https://gitlist.dev/t/20594

## PICCA Frédéric-Emmanuel, 2009-08-14 10:42

Subject: trailling whitespace with git am ?
Message-ID: <606CC410B038E34CB97646A32D0EC0BF0181FAB4@venusbis.synchrotron-soleil.fr>
URL: https://gitlist.dev/e/606CC410B038E34CB97646A32D0EC0BF0181FAB4%40venusbis.synchrotron-soleil.fr

```
hello

I attached a patch that someone sent to me
the public repository is
http://repo.or.cz/w/diffractometer.git

this patch must be apply on the next branch

but when I try to use
git am, I have this sort of message:

mordor% git am /home/picca/Projets/patches/0001-Add-the-POGO-TO-DELETE-comment-to-ComputedAnglesClea.patch 
Applying: 'Add the POGO TO DELETE comment to ComputedAnglesClear command'
/tmp/diffractometer/.git/rebase-apply/patch:13: trailing whitespace.

/tmp/diffractometer/.git/rebase-apply/patch:14: trailing whitespace.
	/* POGO TO DELETE */
error: patch failed: src/Diffractometer/Diffractometer.cpp:2023
error: src/Diffractometer/Diffractometer.cpp: patch does not apply
Patch failed at 0001 'Add the POGO TO DELETE comment to ComputedAnglesClear command'
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".


so git do not want to apply it.

I was looking in the patch file about thoses trailing whitespace but I found nothing
until I rewrote myself this complicate patch :)
then I produced a diff beetween my patch and the original one.

I also attached it.
using emacs/vi I saw immediately the problem... It was a dos/unix file format problem. So the first message of git am was no helpfull at all for me. It would be nice to detect this format
problem when applying the patch and says something like
this patch is in dos format on an unix platform I can not apply it.

the a short explaination of what solution are possibles for the users.

now the question is:

what must I tell to that person if I want to work with her (as she is charming the forget about here is a no op :))
change your editor or is it a git configuration problem ? I suppose she is using msygit but I can not affirm this.

thanks

Frédéric



From 2ad19d21660e7a94cba0e7eaedbb867208832ca2 Mon Sep 17 00:00:00 2001
From: teresa <tnunez@mail.desy.de>
Date: Fri, 14 Aug 2009 10:46:09 +0200
Subject: [PATCH] 'Add the POGO TO DELETE comment to ComputedAnglesClear command'

---
 src/Diffractometer/Diffractometer.cpp |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/Diffractometer/Diffractometer.cpp b/src/Diffractometer/Diffractometer.cpp
index 5d2a55d..98add35 100644
--- a/src/Diffractometer/Diffractometer.cpp
+++ b/src/Diffractometer/Diffractometer.cpp
@@ -2023,6 +2023,8 @@ void Diffractometer::computed_angles_clear()
 	DEBUG_STREAM << "Diffractometer::computed_angles_clear(): entering... !" << endl;
 
 	//	Add your own code to control device here
+
+	/* POGO TO DELETE */
 	_computedAngles_size = 0;
 	if(attr_ComputedAngles_read) {
 		delete [] attr_ComputedAngles_read;
-- 
1.6.4



1,25c1,25
< From 58ed93432f043ee5b2ad44d92a769eddcef4cffa Mon Sep 17 00:00:00 2001
< From: =?utf-8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= <picca@synchrotron-soleil.fr>
< Date: Fri, 14 Aug 2009 12:10:50 +0200
< Subject: [PATCH] * test
< 
< ---
<  src/Diffractometer/Diffractometer.cpp |    2 ++
<  1 files changed, 2 insertions(+), 0 deletions(-)
< 
< diff --git a/src/Diffractometer/Diffractometer.cpp b/src/Diffractometer/Diffractometer.cpp
< index 5d2a55d..98add35 100644
< --- a/src/Diffractometer/Diffractometer.cpp
< +++ b/src/Diffractometer/Diffractometer.cpp
< @@ -2023,6 +2023,8 @@ void Diffractometer::computed_angles_clear()
<  	DEBUG_STREAM << "Diffractometer::computed_angles_clear(): entering... !" << endl;
<  
<  	//	Add your own code to control device here
< +
< +	/* POGO TO DELETE */
<  	_computedAngles_size = 0;
<  	if(attr_ComputedAngles_read) {
<  		delete [] attr_ComputedAngles_read;
< -- 
< 1.6.3.3
< 
---
> From 2ad19d21660e7a94cba0e7eaedbb867208832ca2 Mon Sep 17 00:00:00 2001
> From: teresa <tnunez@mail.desy.de>
> Date: Fri, 14 Aug 2009 10:46:09 +0200
> Subject: [PATCH] 'Add the POGO TO DELETE comment to ComputedAnglesClear command'
> 
> ---
>  src/Diffractometer/Diffractometer.cpp |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/Diffractometer/Diffractometer.cpp b/src/Diffractometer/Diffractometer.cpp
> index 5d2a55d..98add35 100644
> --- a/src/Diffractometer/Diffractometer.cpp
> +++ b/src/Diffractometer/Diffractometer.cpp
> @@ -2023,6 +2023,8 @@ void Diffractometer::computed_angles_clear()
>  	DEBUG_STREAM << "Diffractometer::computed_angles_clear(): entering... !" << endl;
>  
>  	//	Add your own code to control device here
> +
> +	/* POGO TO DELETE */
>  	_computedAngles_size = 0;
>  	if(attr_ComputedAngles_read) {
>  		delete [] attr_ComputedAngles_read;
> -- 
> 1.6.4
> 

```

## Alex Riesen, 2009-08-14 20:10

Subject: Re: trailling whitespace with git am ?
Message-ID: <81b0412b0908141310x7e4acf4fgf4ea71cf53de6eea@mail.gmail.com>
URL: https://gitlist.dev/e/81b0412b0908141310x7e4acf4fgf4ea71cf53de6eea%40mail.gmail.com
In-Reply-To: <606CC410B038E34CB97646A32D0EC0BF0181FAB4@venusbis.synchrotron-soleil.fr>

```
2009/8/14 PICCA Frédéric-Emmanuel
<frederic-emmanuel.picca@synchrotron-soleil.fr>:
> mordor% git am /home/picca/Projets/patches/0001-Add-the-POGO-TO-DELETE-comment-to-ComputedAnglesClea.patch
> Applying: 'Add the POGO TO DELETE comment to ComputedAnglesClear command'
> /tmp/diffractometer/.git/rebase-apply/patch:13: trailing whitespace.
>
> /tmp/diffractometer/.git/rebase-apply/patch:14: trailing whitespace.
>        /* POGO TO DELETE */
> error: patch failed: src/Diffractometer/Diffractometer.cpp:2023
> error: src/Diffractometer/Diffractometer.cpp: patch does not apply

This patch has DOS line endings (like CR, followed by LF).

You can either use dos2unix (or your editor of choice), or update your git
to current master branch, where "git am" handles such patches transparently.

```

## PICCA Frédéric-Emmanuel, 2009-08-14 20:21

Subject: RE : trailling whitespace with git am ?
Message-ID: <606CC410B038E34CB97646A32D0EC0BF0181FABD@venusbis.synchrotron-soleil.fr>
URL: https://gitlist.dev/e/606CC410B038E34CB97646A32D0EC0BF0181FABD%40venusbis.synchrotron-soleil.fr
In-Reply-To: <81b0412b0908141310x7e4acf4fgf4ea71cf53de6eea@mail.gmail.com>

```
> This patch has DOS line endings (like CR, followed by LF).

> You can either use dos2unix (or your editor of choice), or update your git
> to current master branch, where "git am" handles such patches transparently.

I am using git 1.6.3.3 debian unstable is it ok ?

In fact we saw that this problem was due to our webmail

the patch was attached to a mail and using the webmail interface a save to disk transform the CR -> CR LF

we tested it with gmail and the microsoft webmail

now the problem is that a patch with CR+ LF do not have the same signature that a patch
with  only CR.

how can I do the difference between a patch with normal CR+LF (the autor use this format)
and a patch without CR+LF due to the webmail ?

See you

Frederic

```

## Junio C Hamano, 2009-08-14 20:31

Subject: Re: RE : trailling whitespace with git am ?
Message-ID: <7vab22i1dl.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vab22i1dl.fsf%40alter.siamese.dyndns.org
In-Reply-To: <606CC410B038E34CB97646A32D0EC0BF0181FABD@venusbis.synchrotron-soleil.fr>

```
PICCA Frédéric-Emmanuel  <frederic-emmanuel.picca@synchrotron-soleil.fr>
writes:

> how can I do the difference between a patch with normal CR+LF (the autor use this format)
> and a patch without CR+LF due to the webmail ?

That is a question to your webmail provider but I think you generally
can't.  Use dos2unix as Alex suggested and you should be fine.

```

## PICCA Frédéric-Emmanuel, 2009-08-14 20:46

Subject: RE : RE : trailling whitespace with git am ?
Message-ID: <606CC410B038E34CB97646A32D0EC0BF0181FABE@venusbis.synchrotron-soleil.fr>
URL: https://gitlist.dev/e/606CC410B038E34CB97646A32D0EC0BF0181FABE%40venusbis.synchrotron-soleil.fr
In-Reply-To: <7vab22i1dl.fsf@alter.siamese.dyndns.org>

```
> how can I do the difference between a patch with normal CR+LF (the autor use this format)
> and a patch without CR+LF due to the webmail ?

> That is a question to your webmail provider but I think you generally
> can't.  Use dos2unix as Alex suggested and you should be fine.

git am --whitespace=fix was sufficient to apply the patch

```
