From: "Torsten Bögershausen" <tboegi@web.de>
To: Borek Bernard <borekb@gmail.com>, git@vger.kernel.org
Subject: Re: EOL conversion on checkout for text files only
Date: Tue, 07 Apr 2015 10:47:56 +0200 [thread overview]
Message-ID: <552399BC.5030401@web.de> (raw)
In-Reply-To: <CAHNoia06Q-jsskQn6TBkT8zPY7m14qmEL70HBm18CA-SaMrWtg@mail.gmail.com>
On 2015-04-06 20.05, Borek Bernard wrote:
> Hi,
>
> I'd like to propose a new behavior around EOL normalization / forcing
> using gitattributes.
>
> My use case is this: I want to ensure that LF line endings are used in
> the repo *and* in all working directories, on all platforms (in our
> case, the text files MUST be LF even on Windows).
>
> The first part is easy to achieve using this in a .gitattributes file:
>
> * text=auto
>
> This will correctly normalize *text files* in the repo. However, the
> second part (LF forcing on checkout) cannot be achieved easily today
> because adding `eol=lf` will unfortunately process binary files too.
> The only solution today is to mark certain types for conversion (e.g.,
> `*.txt eol=lf`) or, inversely, mark certain types as binary (e.g.,
> `*.png binary`).
>
> Both of these suffer from the same issue: the specific file types must
> be listed explicitly in the .gitattributes file, which means that
> either the types must be known ahead of time or all developers must
> remember to update the .gitattributes file every time a new file type
> appears in the project. Which they won't.
>
> The simplest solution in my eyes would be just to change the behavior of
>
> * text=auto eol=lf
>
> to do both the checkin and checkout EOL conversions on *text files
> only*, using the same text/binary detection algorithm that is already
> in place for the checkin direction. This feels the most intuitive to
> me and I think it would not be a breaking change.
>
> Related IRC discussion:
> http://colabti.org/irclogger/irclogger_log/git?date=2015-04-04#l1143
>
> Thoughts?
>
> Thanks,
> Borek
I think the suggestion makes sense.
I could find 2 things that needs to be improved:
- (1) Specifying "eol=lf" currently overwrites text=auto, this is in convert.c
- (2) The .gitattributes file should overrule core.autocrlf.
This is what the documentation says, but the code doesn't work like that.
See convert.c, output_eol()
- (3) we don't have test cases.
I can probably contribute with 3) and may be 1), but the major work is to improve (or re-factor)
the code in convert.c
prev parent reply other threads:[~2015-04-07 8:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-06 18:05 EOL conversion on checkout for text files only Borek Bernard
2015-04-07 8:47 ` Torsten Bögershausen [this message]
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=552399BC.5030401@web.de \
--to=tboegi@web.de \
--cc=borekb@gmail.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 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).