public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Gioele Barabucci <gioele@svario•it>
To: Junio C Hamano <gitster@pobox•com>
Cc: Michael Haggerty <mhagger@alum•mit.edu>, git@vger•kernel.org
Subject: Re: Git attributes ignored for root directory
Date: Wed, 05 Oct 2011 19:56:05 +0200	[thread overview]
Message-ID: <4E8C9A35.5030504@svario.it> (raw)
In-Reply-To: <7vd3eb8hkb.fsf@alter.siamese.dyndns.org>

On 05/10/2011 19:38, Junio C Hamano wrote:
>> In fact the support for gitattributes using patterns involving "." was
>> pretty spotty in v1.7.6 too.  For example,
>
> The attribute patterns (or exclude patterns for that matter) were never
> designed to name "the current directory". The way to name "everything *in*
> this directory" has always been to say "*" (the "* text=auto" example in
> the documentation says it shows how to set the attribute "for all
> files"). Admittedly the pattern may miss ".*" files.

What if I do not want to say things about the "content" of the directory 
but about the directory itself? This is exactly my case.


> I have to agree that things like "./" and "."  were outside the scope of
> the design; in some cases undefined behaviour given to such patterns may
> have made sense but that was mere accident.

Actually what I have in my `~/.gitattributes` is

     /. show_in_prompt=no

Anyway, I see a conflict between

>   - A leading slash matches the beginning of the pathname.
>     For example, "/{asterisk}.c" matches "cat-file.c" but not
>     "mozilla-sha1/sha1.c".

and

>   - If the pattern is a single dot and nothing else, it matches everything
>     in the current directory.

in the first case `.` is treated as a "glob dot", while in the second 
case it is treated as a "regexp dot". I would find this confusing.

Patterns can match directories using `/foo`. Why don't you just say that 
`.` is equivalent to `./` and `/foo/.` is equivalent to `/foo`?


> So "./" in .gitignore or .gitattributes at the toplevel would match all
> the top-level directories and files but does not apply to the paths
> contained in the matched directories. "." in .gitignore or .gitattributes
> at the toplevel would match everything under the sun.

In the case of `.gitignore`, `/foo/.` and `/foo/` would have the same 
effect and they look sane to me.


> Would it be sensible to assume that users would not be surprised if
> ". text=auto" meant that the attribute applies to every file in the
> worktree?

I would be surprised as I expect `.` to be a "glob dot". But maybe it is 
just me and my prejudices :)

Bye,

-- 
Gioele Barabucci <gioele@svario•it>

  reply	other threads:[~2011-10-05 17:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04 18:52 Git attributes ignored for root directory Gioele Barabucci
2011-10-05 12:05 ` Michael Haggerty
2011-10-05 14:47   ` Gioele Barabucci
2011-10-05 17:38   ` Junio C Hamano
2011-10-05 17:56     ` Gioele Barabucci [this message]
2011-10-05 18:35       ` Junio C Hamano
2011-10-05 20:17         ` Gioele Barabucci
2011-10-05 20:25           ` Junio C Hamano
2011-10-12 22:35     ` Michael Haggerty
2011-10-12 23:12       ` Junio C Hamano
2011-10-13 10:49         ` Gioele Barabucci
2011-10-13 13:16           ` Johannes Sixt
2011-10-13 17:38           ` Junio C Hamano

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=4E8C9A35.5030504@svario.it \
    --to=gioele@svario$(echo .)it \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=mhagger@alum$(echo .)mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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