Re: Git attributes ignored for root directory

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: Git attributes ignored for root directory

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:14

Michael Haggerty [off-list ref] writes:
On 10/05/2011 07:38 PM, Junio C Hamano wrote:
quoted
 - If the pattern is a single dot and nothing else, it matches everything
   in the current directory.
This disagrees with shell usage, where "." represents a directory
itself, not the files within a directory.
Either you misread me, or what I wrote was fuzzy, or perhaps both.

The suggested update to the list of rules very much wants a '.' to mean
the directory itself.  The problem I was solving, which turned out to be
something different from the original issue in the thread was this.

Suppose you have a directory "foo" and want to say "I want to ignore
everything in that directory". You would say "foo/" in .gitignore in the
higher level and you are happy.

How would you say the same thing if the directory to be ignored weren't
"foo" but at the top-level of the working tree? There is no such level
higher than the top-level where you can say "<the name of your project>/"
in its .gitignore file.

The best you could do is to say "./" in the .gitignore file at the
top-level directory, and the update rule you quoted is specifically
designed to address it.

Of course, you could list both ".*" and "*" in the .gitignore file at the
top-level directory for the same effect, but that works only because you
do not have to give values to the entry in .gitignore mechanism. It would
be cumbersome to duplicate two entries in .gitattributes file like that as
a workaround.

Re: Git attributes ignored for root directory

From: Gioele Barabucci <hidden>
Date: 2016-06-15 22:52:14

On 13/10/2011 00:12, Junio C Hamano wrote:
Suppose you have a directory "foo" and want to say "I want to ignore
everything in that directory". You would say "foo/" in .gitignore in the
higher level and you are happy.

How would you say the same thing if the directory to be ignored weren't
"foo" but at the top-level of the working tree? There is no such level
higher than the top-level where you can say "<the name of your project>/"
in its .gitignore file.
Shouldn't `/.` or `/./` work?

I see that `/*/` in `.gitignores` successfully ignores all the 
non-hidden directories in the root project directory. Another accidental 
success? :)

-- 
Gioele Barabucci [off-list ref]

Re: Git attributes ignored for root directory

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:52:14

Am 10/13/2011 12:49, schrieb Gioele Barabucci:
I see that `/*/` in `.gitignores` successfully ignores all the non-hidden
directories in the root project directory. Another accidental success? :)
No, that's by design. The first slash means "apply only in this directory,
not any subdirectories", and the slash at the end means "match only if the
name is a directory".

-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help