threads / discuss / 38850

Re:

Subject: Re:

## tl;dr

6 messages between Mar 18, 2015 and Mar 18, 2015.

replies: 5people: 3as markdown or json

Junio C Hamano· Mar 18, 2015, 20:45 UTC · lore

On Wed, Mar 18, 2015 at 1:33 PM, Alessandro Zanardi <pensierinmusica@gmail.com> wrote:

Show 8 quoted lines
> Here are other sources describing the issue:
>
> http://stackoverflow.com/questions/21109672/git-ignoring-icon-files-because-of-icon-rule
>
> http://blog.bitfluent.com/post/173740409/ignoring-icon-in-gitignore
>
> Sorry to bother the Git development team with such a minor issue, I just
> wanted to know if it's already been fixed.

I do not ship your ~/.gitignore_global file as part of my software, so the problem is not mine to fix in the first place ;-)

Where did you get that file from? We need to find whoever is responsible and notify them so that these users who are having the issue will be helped.

Thanks.
Stefan Beller· Mar 18, 2015, 21:06 UTC · re: Junio C Hamano · lore
On Wed, Mar 18, 2015 at 1:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> On Wed, Mar 18, 2015 at 1:33 PM, Alessandro Zanardi
> <pensierinmusica@gmail.com> wrote:
>> Here are other sources describing the issue:
>>
>> http://stackoverflow.com/questions/21109672/git-ignoring-icon-files-because-of-icon-rule
>>
>> http://blog.bitfluent.com/post/173740409/ignoring-icon-in-gitignore
>>
>> Sorry to bother the Git development team with such a minor issue, I just
>> wanted to know if it's already been fixed.
>
> I do not ship your ~/.gitignore_global file as part of my software,
> so the problem is not mine to fix in the first place ;-)

Maybe this can be understood as a critique on the .gitignore format specifier for paths. (Maybe not, I dunno)

So the `gitignore` script/executable which would generate your .gitignore file for you introduced a bug to also ignore files in "Icons/...." when all you wanted to have is ignoring the file "Icon\r\r" (Mind that \r is an escape character to explain the meaning, gitignore cannot understand it. Sometimes it also shows up as ^M^M depending on operating system/editor used.)

But as you can see, there have been several attempts at fixing it right and https://github.com/github/gitignore/pull/334 eventually got the right fix. (it was merged 2012, which has been a while now), maybe you'd want to use a new version of this gitignore script to regenerate your gitignore?

>
> Where did you get that file from? We need to find whoever is
> responsible and notify them so that these users who are having
> the issue will be helped.

Given that this is part of https://github.com/github/gitignore which is the official collection of .gitignore files from Github, the company, we could ask Jeff or Michael if it is urgent. The actual fix being merged 3 years ago makes me belief it is not urgent though.

Thanks, Stefan

Jeff King· Mar 18, 2015, 21:17 UTC · re: Stefan Beller · lore
On Wed, Mar 18, 2015 at 02:06:22PM -0700, Stefan Beller wrote:
Show 9 quoted lines
> > Where did you get that file from? We need to find whoever is
> > responsible and notify them so that these users who are having
> > the issue will be helped.
> 
> Given that this is part of https://github.com/github/gitignore
> which is the official collection of .gitignore files from Github,
> the company, we could ask Jeff or Michael if it is urgent.
> The actual fix being merged 3 years ago makes me belief
> it is not urgent though.

It looks like the fix they have in that repo does the right thing[1], but for reference, you are much more likely to get results by creating an issue or PR on that repository, rather than asking me.

-Peff
[1] The double-CR fix works because we strip a single CR from the end of
    the line (as a convenience for CRLF systems), and then the remaining
    CR is syntactically significant. But I am surprised that quoting
    like:
      printf '"Icon\r"' >.gitignore
    does not seem to work.
Jeff King· Mar 18, 2015, 21:28 UTC · re: Jeff King · lore
On Wed, Mar 18, 2015 at 05:17:16PM -0400, Jeff King wrote:
Show 8 quoted lines
> [1] The double-CR fix works because we strip a single CR from the end of
>     the line (as a convenience for CRLF systems), and then the remaining
>     CR is syntactically significant. But I am surprised that quoting
>     like:
> 
>       printf '"Icon\r"' >.gitignore
> 
>     does not seem to work.

Answering myself: we don't do quoting like this in .gitignore. We allow backslashing to escape particular characters, like trailing whitespace. So in theory:

  Icon\\r

(where "\r" is a literal CR) would work. But it doesn't, because the CRLF chomping happens separately, and CR is therefore a special case. I suspect you could not .gitignore a file with a literal LF in it at all (and I equally suspect that nobody cares in practice).

-Peff
Junio C Hamano· Mar 18, 2015, 21:33 UTC · re: Jeff King · lore
On Wed, Mar 18, 2015 at 2:28 PM, Jeff King <peff@peff.net> wrote:
Show 21 quoted lines
> On Wed, Mar 18, 2015 at 05:17:16PM -0400, Jeff King wrote:
>
>> [1] The double-CR fix works because we strip a single CR from the end of
>>     the line (as a convenience for CRLF systems), and then the remaining
>>     CR is syntactically significant. But I am surprised that quoting
>>     like:
>>
>>       printf '"Icon\r"' >.gitignore
>>
>>     does not seem to work.
>
> Answering myself: we don't do quoting like this in .gitignore. We allow
> backslashing to escape particular characters, like trailing whitespace.
> So in theory:
>
>   Icon\\r
>
> (where "\r" is a literal CR) would work. But it doesn't, because the
> CRLF chomping happens separately, and CR is therefore a special case. I
> suspect you could not .gitignore a file with a literal LF in it at all
> (and I equally suspect that nobody cares in practice).

What does the Icon^M try to catch, exactly? Is it a file? Is it a directory? Is it "anything that begins with Icon^M"?

I am wondering if we need an opposite of '/' prefix in the .gitignore file to say "the pattern does not match a directory, only a file".

Stefan Beller· Mar 18, 2015, 21:45 UTC · re: Junio C Hamano · lore
On Wed, Mar 18, 2015 at 2:33 PM, Junio C Hamano <gitster@pobox.com> wrote:
> What does the Icon^M try to catch, exactly? Is it a file? Is it a directory?
> Is it "anything that begins with Icon^M"?
It seems to be a special hidden file on Macs for UI convenience.
Show 8 quoted lines
> On Apr 25, 2005, at 6:21 AM, Peter N. Lundblad wrote:
>
> The Icon^M file in a directory gives that directory a custom icon in
> the Finder. They are a holdover from MacOS 9 but there are still a lot
> of them out there. The "new" OS X format for icons are .icns files but
> I'm not sure if you can do custom file directory icons with them (you
> probably can, I just haven't found the docs yet).
>

← back to recent threads