git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-am and CRLF

From
Brandon Casey <drafnel@gmail.com>
Date
Mar 13, 2013, 17:42 UTC
Message-ID
<CA+sFfMfJp1-REXVjipUhsVrUKDSmhrBkV0yd_=sMwwmiw2aypQ@mail.gmail.com>
In-Reply-To
<CABPQNSb9euNgCY9g617opThHC8OUpZQvJ+peor8Yk39LZ+y+TQ@mail.gmail.com>
On Wed, Mar 13, 2013 at 9:54 AM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 22 quoted lines
> I recently tried to apply a patch-series to a repo that is
> unfortunately full of CRLF files, and was a bit surprised that it
> didn't work at all.
>
> So I made a small repro-case, and it seems CRLF new-lines is indeed
> the problem. Any clue how to fix it? The way I see it, we should
> simply be able top treat the CR as any other character, and succeed.
> But that doesn't seem to happen...
>
> git init test &&
> (
>         cd test/ &&
>         git config core.autocrlf false &&
>         printf "%s\r\n%s\r\n" "foo" "bar" > test.txt &&
>         git add test.txt &&
>         git commit -m. &&
>         printf "%s\r\n%s\r\n%s\r\n" "foo" "baz" "bar" > test.txt &&
>         git commit -am. &&
>         git format-patch -1 &&
>         git reset --hard HEAD^ &&
>         git am 0001-.patch
> )
Does 'git am --keep-cr' help?

Unfortunately the original information about line ending is lost once a patch is sent via email since RFC2822/822 dictates that the line ending in an email must be crlf. So by default, mailsplit strips it.

-Brandon
Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 2 of 3 in “git-am and CRLF”
  1. Erik Faye-LundMar 13, 2013
  2. Brandon CaseyMar 13, 2013
  3. Erik Faye-LundMar 13, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.