From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: git-apply can't apply patches to CRLF-files Date: Fri, 26 May 2006 11:05:41 -0700 Message-ID: <7virnsk6fe.fsf@assigned-by-dhcp.cox.net> References: <4477262A.5000301@Intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org X-From: git-owner@vger.kernel.org Fri May 26 20:06:05 2006 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FjghJ-0005a7-A8 for gcvg-git@gmane.org; Fri, 26 May 2006 20:06:05 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751220AbWEZSFn (ORCPT ); Fri, 26 May 2006 14:05:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751224AbWEZSFn (ORCPT ); Fri, 26 May 2006 14:05:43 -0400 Received: from fed1rmmtao11.cox.net ([68.230.241.28]:55772 "EHLO fed1rmmtao11.cox.net") by vger.kernel.org with ESMTP id S1751220AbWEZSFm (ORCPT ); Fri, 26 May 2006 14:05:42 -0400 Received: from assigned-by-dhcp.cox.net ([68.4.9.127]) by fed1rmmtao11.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060526180542.CBYQ9215.fed1rmmtao11.cox.net@assigned-by-dhcp.cox.net>; Fri, 26 May 2006 14:05:42 -0400 To: Salikh Zakirov In-Reply-To: <4477262A.5000301@Intel.com> (Salikh Zakirov's message of "Fri, 26 May 2006 20:00:42 +0400") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: Salikh Zakirov writes: > 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. I do not think that is the case. > Is this a bug or known deficiency? This particular reproduction recipe looks like a PEBCAK; it does not reproduce for me, but I do not have/use unix2dos so I did DOSsy line endings a bit differently. git init-db echo 'abc@' | tr '[@]' '[\015]' >a git add a git commit -m initial echo 'def@' | tr '[@]' '[\015]' >>a git commit -a -m second git format-patch HEAD^ git reset --hard HEAD^ git am 0*.txt > 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 Here the first line of a ends with \r\n already end the second line ends with a \n. Does running unix2dos on that do a sensible thing on the first line? Compare it with my above recipe which appends DOSsy line at the end of the file. Having said that, CRLF is unsafe for E-mail transfers anyway, so I think we would need a special option to tell git-apply that it should match '\n' that appears in the patch with '\r\n' in the file being patched. But I do not think that has anything to do with the breakage you saw in your reproduction recipe.