From: Junio C Hamano <gitster@pobox.com>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: git discussion list <git@vger.kernel.org>
Subject: Re: Surprising interaction of "binary" and "eol" gitattributes
Date: Thu, 05 Mar 2015 14:08:24 -0800 [thread overview]
Message-ID: <xmqqwq2v14iv.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <54F88684.3020905@alum.mit.edu> (Michael Haggerty's message of "Thu, 05 Mar 2015 17:38:28 +0100")
Michael Haggerty <mhagger@alum.mit.edu> writes:
> I would expect that the following .gitattributes file
>
> * eol=crlf
> *.png -text
>
> would leave EOL translation turned off for PNG files. In other words, I
> would expect that explicitly setting "-text" would take precedence over
> the fact that setting "eol" implies that a file should be considered to
> be "text".
>
> I would even more strongly expect
>
> * eol=crlf
> *.png binary
>
> to turn off EOL translation for PNG files.
>
> But in fact, in both of the above cases, EOL translation is turned *on*
> for PNG files.
>
> I propose that "-text" should override any setting for "eol" (which
> would of course fix both problems, since "binary" is equivalent to
> "-diff -merge -text"). What do people think?
Hmm, is there really something that needs a new proposal and
opinions?
The way I read the flow in convert.c is:
convert_to_git() uses input_crlf_action() to figure out what
crlf_to_git() conversion is necessary.
input_crlf_action() looks at text_attr and says CRLF_BINARY when
it is CRLF_BINARY without looking at eol_attr at all.
text_attr above is ca.crlf_action in convert_to_git().
The whole ca.* comes from convert_attrs() inspecting attributes
on the incoming path.
convert_attrs() inspects "eol" and "text" attributes, among
others, and sets crlf_action by calling git_path_check_crlf().
git_path_check_crlf() looks at the 'text' attribute; if it is
set to false, it returns CRLF_BINARY.
crlf_to_git() when given crlf_action==CRLF_BINARY is a no-op.
So, with the above attributes where anything is eol=crlf by default
and in addition *.png is binary (which contains -text), we shouldn't
get any crlf munging. Am I reading/following the code incorrectly?
Puzzled....
next prev parent reply other threads:[~2015-03-05 22:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 16:38 Surprising interaction of "binary" and "eol" gitattributes Michael Haggerty
2015-03-05 20:49 ` Torsten Bögershausen
2015-03-05 22:08 ` Junio C Hamano [this message]
2015-03-06 5:59 ` Torsten Bögershausen
2015-03-06 17:51 ` Michael Haggerty
2015-03-06 21:30 ` Torsten Bögershausen
2015-03-10 19:25 ` Michael Haggerty
2015-03-10 20:01 ` Junio C Hamano
2015-03-10 22:16 ` Michael Haggerty
2015-03-10 22:54 ` Junio C Hamano
2015-03-11 5:54 ` Torsten Bögershausen
2015-03-11 17:59 ` Junio C Hamano
2015-03-11 20:30 ` Johannes Sixt
2015-03-11 21:31 ` Junio C Hamano
2015-03-11 21:43 ` Junio C Hamano
2015-03-10 20:26 ` Torsten Bögershausen
2015-03-10 22:24 ` Michael Haggerty
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqwq2v14iv.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).