From: Marius Storm-Olsen <marius@trolltech.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>,
"Shawn O. Pearce" <spearce@spearce.org>,
Julian Phillips <julian@quantumfyre.co.uk>,
git@vger.kernel.org
Subject: Re: [PATCH 3/3] Teach "git branch" about --new-workdir
Date: Tue, 24 Jul 2007 20:02:18 +0200 [thread overview]
Message-ID: <46A63EAA.6080203@trolltech.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0707241431540.14781@racer.site>
[-- Attachment #1: Type: text/plain, Size: 3287 bytes --]
>> So, it's look like this ('yes' mean CRLF EOL):
>> Repo | Working dir | Convert EOL?
>> ---------------------------------
>> 1) - LF no
>> 2) - CRLF yes
>> 3) LF LF no
>> 4) LF CRLF yes
>> 5) CRLF LF no
>> 6) CRLF CRLF yes
>>
>> The problem is that currently 6) is 'yes', and turns the file into
>> a LF file, which it shouldn't.
>
> Shouldn't it? But then you should set core.autocrlf = false, no?
>
> AFAIU the purpose of autocrlf is to _always_ have UNIX line endings
> in the checked in stuff.
I realize that I might be talking 'out of context', so to speak; so it's
hard to see where I'm going with this. So, I'll start from the
beginning. :-)
1) IMO, git should on Windows always do CRLF conversion, as this is what
Windows developers in general expect. (CRLF text-files that is, not the
conversion.) Meaning that
core.autocrlf = Windows
by default. Where 'Windows' would be of true/false value which is true
when on Windows and false when on other platforms. (Not that we should
_have_ such an option, but the concept at least.)
2) Most Windows developers in the category above currently do
git-config --global core.autocrlf true
once, and be done with it.
However, for every text-file they want in the repo which _should_
contain CRLF EOLs they would have to add this file to either a
.gitattributes file in that same directory, or to
.git/info/attributes
with the
<filepath> -crlf
to ensure that the autocrlf conversion is not triggered for those files.
Now, for Unix users that seems like a small price to pay, and of course
_they_ don't have to worry about it. It's up to the Windows developers
to take the pain and add these .gitattributes files, and keep track
whenever new CRLF files appear in the repo from other non-Windows
developers.
3) My suggestion in the previous mail would to a large extent alleviate
this problem, since once in the repo with CRLF lineendings the 'autocrlf
conversion' routine wouldn't automatically try to convert it back to LF
endings, even if this file is not in any attributes file with '-crlf'.
It would mean that we wouldn't have to add _any_ files to attributes
files at all, but only have to teach git a way to avoid crlf-converting
a given file when commiting a change. For example, on Windows you could
then do something like:
git update-index --crlf my_DOS_file.txt
git commit -m "Add a CRLF file to the repo"
then forget about it.
No need to add a .gitattributes in your own repo.
No need for linux users to worry about Windows users.
No need to Windows users to clean up the repos for the linux users.
IMO, the .gitattributes file with '<filepath> -crlf' is a hack-fix to a
problem we shouldn't be having in the first place. We should be able to
write in the git documentation:
"Text files are stored with Unix line ending in Git. If you need a
text file to contain DOS line endings on all platforms, use the --crlf
option on the update-index command."... or something to that effect.
Ok, a bit longer mail than I expected/wanted, but I hope it explains the
idea successfully, and convincingly. ;-)
Later!
--
.marius
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]
next prev parent reply other threads:[~2007-07-24 18:02 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-22 18:56 [PATCH 3/3] Teach "git branch" about --new-workdir Johannes Schindelin
2007-07-22 19:16 ` Daniel Barkalow
2007-07-22 19:24 ` Johannes Schindelin
2007-07-22 21:09 ` Julian Phillips
2007-07-22 21:25 ` Johannes Schindelin
2007-07-22 21:50 ` Julian Phillips
2007-07-22 21:59 ` Johannes Schindelin
2007-07-22 22:24 ` Julian Phillips
2007-07-22 22:46 ` Jakub Narebski
2007-07-22 23:37 ` Johannes Schindelin
2007-07-22 23:02 ` Johannes Schindelin
2007-07-23 3:56 ` Shawn O. Pearce
2007-07-23 4:45 ` Junio C Hamano
2007-07-23 5:14 ` Shawn O. Pearce
2007-07-23 5:22 ` Shawn O. Pearce
2007-07-23 10:32 ` Johannes Schindelin
2007-07-23 10:42 ` Johannes Schindelin
2007-07-24 8:19 ` Marius Storm-Olsen
2007-07-24 9:02 ` Johannes Schindelin
2007-07-24 9:47 ` Junio C Hamano
2007-07-24 11:07 ` Johannes Schindelin
2007-07-24 11:14 ` Marius Storm-Olsen
2007-07-24 12:06 ` Julian Phillips
2007-07-24 12:28 ` Marius Storm-Olsen
2007-07-24 12:37 ` Johannes Schindelin
2007-07-24 13:47 ` Josef Weidendorfer
2007-07-24 13:54 ` Johannes Schindelin
2007-07-24 14:21 ` Josef Weidendorfer
2007-07-25 0:09 ` Jakub Narebski
2007-07-24 12:42 ` Johannes Schindelin
2007-07-24 13:26 ` Marius Storm-Olsen
2007-07-24 13:29 ` Marius Storm-Olsen
2007-07-24 13:33 ` Johannes Schindelin
2007-07-24 18:02 ` Marius Storm-Olsen [this message]
2007-07-24 18:30 ` Johannes Schindelin
2007-07-24 19:36 ` Marius Storm-Olsen
2007-07-24 23:15 ` Alex Riesen
2007-07-25 6:47 ` Marius Storm-Olsen
2007-07-25 9:39 ` Johannes Schindelin
2007-07-25 10:22 ` Steven Grimm
2007-07-25 11:05 ` Andy Parkins
2007-07-25 12:10 ` Marius Storm-Olsen
2007-07-25 14:09 ` Johannes Schindelin
2007-07-25 20:40 ` Linus Torvalds
2007-07-26 11:51 ` Christian MICHON
2007-07-23 8:31 ` Julian Phillips
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=46A63EAA.6080203@trolltech.com \
--to=marius@trolltech.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=julian@quantumfyre.co.uk \
--cc=spearce@spearce.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 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).