git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stepan Kasal <kasal@ucw.cz>
To: Johannes Sixt <j6t@kdbg.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Torsten Bögershausen" <tboegi@web.de>,
	git@vger.kernel.org,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	sandals@crustytoothpaste.net
Subject: Re: [PATCH/RFC] blame: CRLF in the working tree and LF in the repo
Date: Tue, 28 Apr 2015 23:58:07 +0200	[thread overview]
Message-ID: <20150428215807.GE1433@camelia.ucw.cz> (raw)
In-Reply-To: <553FEB4F.7050409@kdbg.org>

Hello Hannes,

let me correct my previous statement:

On Mon, Apr 27, 2015 at 08:58:05PM +0200, Johannes Sixt wrote:
> When I commit my C source code files with CRLF into the repository  
> (because I do not set any line ending options or configurations or any  
> 'text' attributes or similar), do I then commit binary files or text  
> files? Should I expect not to see any diffs?

Of course, you can see diffs.  The files are not binary in that
sense.

Johannes Sixt <j6t@kdbg.org> writes:
> I set none of these. But I do commit CRLF and expect to get CRLF
> back. [...]

That works.  You will not encounter any problem.  (Supposing you
do not change the line ending options, of course.)

Finally, let me explain my previous statement:
> Am 27.04.2015 um 08:11 schrieb Stepan Kasal:
>> Git does not support CRLF as the internal line separator.

I'm often asked: "How do I set up git so that it uses CRLF in text
files in the repository and checks them out with CRLF on Windows and
with LF on unixy systems?"

My answer to that question always was that you cannot configure the
internal line separator in git repo, it is always LF.  Your only
chance to support both line endings is to have LF in the repo and
configure the Windows client to do the conversion.

>> If you commit file in binary mode with CRLF, you are on your own.

OK, scratch the word "binary".  The files in the repo are actually
text files.  But each text line is contains one more char than you
would think.  From time to time, this lurks:

1) Does "git grep ';$' HEAD" find anything?
2) What about "git grep ';.$' HEAD" ?
   Or "git grep `printf ';\r$' HEAD"  ?

3) If you try things like
       git diff HEAD^^..HEAD^ >outfile.diff
   and then open outfile.diff with a suitable editor (e.g. vim), you
   can see an extra ^M at the end of some lines (the content ones).

This is why I tell users that they are on their own if they decide to
use the setup you described.

Have a nice day,
	Stepan

  reply	other threads:[~2015-04-28 21:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-26 12:02 [PATCH/RFC] blame: CRLF in the working tree and LF in the repo Torsten Bögershausen
2015-04-26 18:36 ` Eric Sunshine
2015-04-27  4:39 ` Stepan Kasal
2015-04-27  5:31 ` Junio C Hamano
2015-04-27  6:11   ` Stepan Kasal
2015-04-27 18:58     ` Johannes Sixt
2015-04-27 19:45       ` Torsten Bögershausen
2015-04-28 18:42         ` Johannes Sixt
2015-04-28 19:52           ` Junio C Hamano
2015-04-28 20:19             ` Johannes Sixt
2015-04-28 21:58               ` Stepan Kasal [this message]
2015-04-27 17:47   ` Junio C Hamano
2015-04-27 19:40     ` Torsten Bögershausen
2015-04-28  7:28       ` Junio C Hamano
2015-04-28  7:40         ` Torsten Bögershausen
2015-04-28  1:17     ` brian m. carlson

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=20150428215807.GE1433@camelia.ucw.cz \
    --to=kasal@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=sandals@crustytoothpaste.net \
    --cc=tboegi@web.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).