All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: "Torsten Bögershausen" <tboegi@web.de>,
	"Junio C Hamano" <gitster@pobox.com>
Cc: git discussion list <git@vger.kernel.org>
Subject: Re: Surprising interaction of "binary" and "eol" gitattributes
Date: Tue, 10 Mar 2015 23:24:27 +0100	[thread overview]
Message-ID: <54FF6F1B.2030900@alum.mit.edu> (raw)
In-Reply-To: <54FF5376.7070500@web.de>

On 03/10/2015 09:26 PM, Torsten Bögershausen wrote:
> On 10.03.15 20:25, Michael Haggerty wrote:
>> [...]
>> I'm still trying to infer the spirit of the current behavior, so caveats
>> here.
>>
>> This comes from a real-life scenario where a user, somewhere early in
>> .gitattributes, had
>>
>>     * text
>>     * eol=crlf
>>
>> and then later (this could be in a subdirectory) tried to carve out
>> exceptions to this rule by using
>>
>>     *.png binary
>>     * text=auto
> Hm,
> I can see 2 problems here:
> the "binary" attribute does not exist at all.
>
> I sometimes which we had it, but we don't.
> There is "text" and "-text", and that is it.

There is a "binary" macro that is equivalent to "-diff -merge -text". It
is documented in gitattributes(5) under "USING MACRO ATTRIBUTES" and
"DEFINING MACRO ATTRIBUTES".

> The other problem is the order of the lines, which is fully
> intuitive for each person who has ever written a "matching parser".
> 
> The parser matches each file namr on it's own, depending on the matching:
> 
> *.png -text
> * text=auto
> means that all png files are binary, and ALL files are "auto".
> 
> Guess what happens to the png's ?
> 
> The second rule wins, as it is the last rule processed.
> 
> git check-attr text *
> A.png: text: auto
> B.txt: text: auto

That much is perfectly clear. The question is, what should happen when
the contents-based heuristic, whose use was requested by "text=auto",
determines that A.png is in fact a binary file? Should it be subjected
to EOL translation anyway? I think not.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu

      reply	other threads:[~2015-03-10 22:24 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
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 [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=54FF6F1B.2030900@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.