public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Ralf Thielow <ralf.thielow@googlemail•com>
Cc: git <git@vger•kernel.org>
Subject: Re: [BUG] attribute "eol" with "crlf"
Date: Fri, 16 Dec 2011 19:21:07 +0100	[thread overview]
Message-ID: <vpqr504wf70.fsf@bauges.imag.fr> (raw)
In-Reply-To: <CAN0XMO+OOdTJ+aNMSc2G3RVc7Wfypr4+7dU3US9GVAmMiSJ7cg@mail.gmail.com> (Ralf Thielow's message of "Fri, 16 Dec 2011 18:44:21 +0100")

Ralf Thielow <ralf.thielow@googlemail•com> writes:

> There's a bug in git-1.7.8 if you use the attribute "eol" with "crlf".
>
> Steps to reproduce:
> - add and commit a text file which uses 0d0a for line breaks
> 7465 7374 0d0a 0d0a 7465 7374 0d0a       test....test..
> - add ".gitattributes" with "*.txt eol=crlf"
> - change a line in the file
> - execute "git checkout [file]"
>
> The result is:
> 7465 7374 0d0d 0a0d 0d0a 7465 7374 0d0d  test......test..

It seems to me to be the expected behavior. You committed a file whose
line endings are not normalized to LF in the repository, and asked for a
conversion LF -> CRLF on checkout, which Git did.

Git can't know exactly the moment when you edit .gitattributes, so it
can't do the conversion at the time you add the eol=crlf attribute. It
does it on checkout.

> 0d0a was replaced by 0d0d0a.

I'd say 0a (LF) was replaced by 0d0a (CRLF).

What behavior would you have expected?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  parent reply	other threads:[~2011-12-16 18:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16 17:44 [BUG] attribute "eol" with "crlf" Ralf Thielow
2011-12-16 18:03 ` Junio C Hamano
2011-12-16 18:49   ` Ralf Thielow
2011-12-16 18:21 ` Matthieu Moy [this message]
2011-12-16 18:28   ` Ralf Thielow
2011-12-16 20:09     ` Adam Borowski
2011-12-16 20:53       ` Ralf Thielow
2011-12-16 21:21   ` Junio C Hamano
2011-12-16 22:05     ` Ralf Thielow
2011-12-16 22:17       ` Junio C Hamano
2011-12-16 22:36         ` Ralf Thielow
2011-12-16 23:24           ` Junio C Hamano
2011-12-16 23:34     ` Junio C Hamano
2011-12-17 18:04       ` Ralf Thielow
2011-12-17 19:48         ` 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=vpqr504wf70.fsf@bauges.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=git@vger$(echo .)kernel.org \
    --cc=ralf.thielow@googlemail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox