All of lore.kernel.org
 help / color / mirror / Atom feed
* am fails to apply patches for files with CRLF lineendings
@ 2009-12-14 18:33 Björn Steinbrink
  2009-12-14 20:27 ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Björn Steinbrink @ 2009-12-14 18:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: jk, git

Hi,

Jason King (cc'd) reported that a patch for a file with CRLF lineendings
fails to apply, even if generated and applied in the same repo.

doener@atjola:x $ git init

doener@atjola:x (master) $ for x in $(seq 10); do echo -e "$x\r" >> foo; done
doener@atjola:x (master) $ vim foo
doener@atjola:x (master) $ git add foo; git commit -m init
[master (root-commit) b59b963] init
 1 files changed, 10 insertions(+), 0 deletions(-)
 create mode 100644 foo

doener@atjola:x (master) $ sed -ie s/5/changed/ foo
doener@atjola:x (master) $ git commit -am changed
[master fe4ee44] changed
 1 files changed, 1 insertions(+), 1 deletions(-)

doener@atjola:x (master) $ git format-patch HEAD^
0001-changed.patch

doener@atjola:x (master) $ git checkout HEAD^
Note: moving to 'HEAD^' which isn't a local branch

doener@atjola:x ((b59b963...)) $ git am 0001-changed.patch
Applying: changed
error: patch failed: foo:2
error: foo: patch does not apply
Patch failed at 0001 changed
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".

Using "--whitespace=fix" makes the patch apply, but converts the changed
line and the context area from CRLF to LF.

Commit c2ca1d7 "Allow mailsplit ... to handle mails with CRLF line-endings"
seems to be responsible. Using "git am --rebasing" to trigger the
--keep-cr flag to mailsplit makes things work:

doener@atjola:x ((b59b963...)) $ git am --rebasing 0001-changed.patch
Applying: changed

And reverting that commit also gives the expected whitespace warning
(which is somehow squelched by the --rebasing flag it seems).

doener@atjola:x ((b59b963...)) $ git am 0001-changed.patch
Applying: changed
/home/doener/x/.git/rebase-apply/patch:14: trailing whitespace.
changed
warning: 1 line adds whitespace errors.

Björn

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

end of thread, other threads:[~2010-02-13 19:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-14 18:33 am fails to apply patches for files with CRLF lineendings Björn Steinbrink
2009-12-14 20:27 ` Junio C Hamano
2009-12-14 20:34   ` Junio C Hamano
     [not found]   ` <776A5AB0-E6BC-4230-800E-BE1B7A6B09BF@silentcow.com>
2009-12-14 20:55     ` Björn Steinbrink
2009-12-14 21:16       ` Jason King
2009-12-14 22:56   ` Brandon Casey
2009-12-14 23:22     ` Junio C Hamano
     [not found]       ` <ee63ef30912141650ie05baf4kab8505adf160c62e@mail.gmail.com>
2009-12-15  1:25         ` Björn Steinbrink
2009-12-15 22:52           ` Andreas Schwab
2009-12-16  0:38             ` Andreas Schwab
2009-12-15  2:09         ` Fwd: " Brandon Casey
2009-12-15  6:33           ` Sverre Rabbelier
2009-12-15 16:04             ` Brandon Casey
2009-12-15 23:18           ` Fwd: " Andreas Schwab
2009-12-15  2:12         ` Junio C Hamano
2009-12-15  3:59           ` Brandon Casey
     [not found]       ` <F25E4EFA-BDD8-4920-96FC-2347AD5A3605@silentcow.com>
2010-01-05 16:41         ` Brandon Casey
2010-02-13 19:07           ` Jason King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.