All of lore.kernel.org
 help / color / mirror / Atom feed
From: Salikh Zakirov <Salikh.Zakirov@Intel.com>
To: git@vger.kernel.org
Subject: git-apply can't apply patches to CRLF-files
Date: Fri, 26 May 2006 20:00:42 +0400	[thread overview]
Message-ID: <4477262A.5000301@Intel.com> (raw)

Hello, 

git-apply can't apply the patch to file with windows-style CRLF line endings,
even if the patch was generated by git-format-patch.

Is this a bug or known deficiency?

The following script reproduces the problem
---------
#!/bin/sh
set -e
mkdir trash
cd trash
git init-db
echo "abc" > a
unix2dos a
git add a
git commit -m "a added" a
echo "cde" >> a
unix2dos a
git commit -m "a modified" a
git format-patch HEAD^
git reset --hard HEAD^
git am 0001*.txt
---------

The resulting output is
---------
$ ./test
defaulting to local storage area
a: done.
Committing initial tree 357c56061b96c1548b15168bc0d02e8d1a319e0b
a: done.
0001-a-modified.txt

Applying 'a modified'

error: patch failed: a:1
error: a: patch does not apply
Patch failed at 0001.
When you have resolved this problem run "git-am --resolved".
If you would prefer to skip this patch, instead run "git-am --skip".
---------

If I remove unix2dos calls and so the file has normal unix LF line endings,
then the result is correct as expected

---------
$ ./test
defaulting to local storage area
Committing initial tree 6afc8719a182fed19980da0e53d13fba1f94dd3f
0001-a-modified.txt

Applying 'a modified'

Wrote tree 49f5181a399bbcaac1da3bf693c466a281c4a255
Committed: 2b0a2936d0a65b3511882b8e88586ab054dd15b2
---------

             reply	other threads:[~2006-05-26 16:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-26 16:00 Salikh Zakirov [this message]
2006-05-26 18:05 ` git-apply can't apply patches to CRLF-files Junio C Hamano
2006-05-27 17:57   ` [PATCH] Fixed Cygwin CR-munging problem in mailsplit Salikh Zakirov
2006-05-27 18:21     ` Junio C Hamano
2006-05-27 18:25       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4477262A.5000301@Intel.com \
    --to=salikh.zakirov@intel.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.