Git development
 help / color / mirror / Atom feed
* trailling whitespace with git am ?
@ 2009-08-14 10:42 PICCA Frédéric-Emmanuel
  2009-08-14 20:10 ` Alex Riesen
  0 siblings, 1 reply; 9+ messages in thread
From: PICCA Frédéric-Emmanuel @ 2009-08-14 10:42 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 1936 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-the-POGO-TO-DELETE-comment-to-ComputedAnglesClea.patch --]
[-- Type: text/x-patch; name="0001-Add-the-POGO-TO-DELETE-comment-to-ComputedAnglesClea.patch", Size: 899 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: toto.diff --]
[-- Type: text/x-patch; name="toto.diff", Size: 1881 bytes --]

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
> 

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* Re: RE : trailling whitespace with git am ?
@ 2009-08-14 20:31 Alex Riesen
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Riesen @ 2009-08-14 20:31 UTC (permalink / raw)
  To: PICCA Frédéric-Emmanuel; +Cc: git

On Fri, Aug 14, 2009 at 22:21, PICCA
Frédéric-Emmanuel<frederic-emmanuel.picca@synchrotron-soleil.fr>
wrote:
>> 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 ?

No. I just checked - it is not even in master yet. You can merge
the commits at c2ca1d79dbd54b06. That's what I am using. These
are merged in Junio's next already, so you'll see them in master
someday. Meanwhile I can have it like this:

$ git clone git://git.kernel.org/pub/scm/git/git.git
$ cd git
$ git merge c2ca1d79dbd54b06
$ make && make test && make doc
$ make install install-doc

This will install the freshly compiled git in your home (~/bin,
~/share, ~/libexec, ...)

I would recommend to remove the debian's git first, BTW.

> 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 ?

Just replace the trailing CR+LF with just LF. The program named
"dos2unix" does that.

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: trailling whitespace with git am ?
@ 2009-08-14 21:43 Alex Riesen
  2009-08-14 21:50 ` RE : " PICCA Frédéric-Emmanuel
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Riesen @ 2009-08-14 21:43 UTC (permalink / raw)
  To: PICCA Frédéric-Emmanuel; +Cc: Junio C Hamano, git

On Fri, Aug 14, 2009 at 22:50, PICCA
Frédéric-Emmanuel<frederic-emmanuel.picca@synchrotron-soleil.fr>
wrote:
>> > git am --whitespace=fix was sufficient to apply the patch
>
>> Depending on your situation it can be an overkill: it'll remove _all_ trailing
>> white space. Not just \r (CR).
>
> so /s /t and /r are the same things for git ?
>

almost. For git-apply's whitespace fixing code. Why?

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: RE : trailling whitespace with git am ?
@ 2009-08-14 22:16 Alex Riesen
  2009-08-14 22:21 ` PICCA Frédéric-Emmanuel
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Riesen @ 2009-08-14 22:16 UTC (permalink / raw)
  To: PICCA Frédéric-Emmanuel; +Cc: Junio C Hamano, git

On Fri, Aug 14, 2009 at 23:50, PICCA
Frédéric-Emmanuel<frederic-emmanuel.picca@synchrotron-soleil.fr>
wrote:
> Maybe git apply should warn the user a different way if their is that sort of
> dos/unix imcompatibilities.

As it all is history (in the new code) already, there is nothing to talk about.
Git-am in "next" branch just accepts such a patch without a warning.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-08-14 22:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-14 10:42 trailling whitespace with git am ? PICCA Frédéric-Emmanuel
2009-08-14 20:10 ` Alex Riesen
2009-08-14 20:21   ` RE : " PICCA Frédéric-Emmanuel
2009-08-14 20:31     ` Junio C Hamano
2009-08-14 20:46       ` RE : " PICCA Frédéric-Emmanuel
  -- strict thread matches above, loose matches on Subject: below --
2009-08-14 20:31 Alex Riesen
2009-08-14 21:43 Alex Riesen
2009-08-14 21:50 ` RE : " PICCA Frédéric-Emmanuel
2009-08-14 22:16 Alex Riesen
2009-08-14 22:21 ` PICCA Frédéric-Emmanuel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox