git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Gioele Barabucci <gioele@svario.it>
Cc: git@vger.kernel.org
Subject: Re: Git attributes ignored for root directory
Date: Wed, 05 Oct 2011 14:05:46 +0200	[thread overview]
Message-ID: <4E8C481A.1070808@alum.mit.edu> (raw)
In-Reply-To: <4E8B55FB.1050203@svario.it>

On 10/04/2011 08:52 PM, Gioele Barabucci wrote:
> I just updated to git v1.7.7 using the Ubuntu Lucid PPA and I found that
> `git check-attr` is broken now.
> 
> I have this attribute in my `$HOME/.gitattributes` file:
> 
>     /. show_in_prompt=no
> 
> Now, if I go to `$HOME` and run
> 
>     git check-attr show_in_prompt -- .
> 
> With git v1.7.6 this is the answer I got:
> 
>     .: show_in_prompt: no
> 
> With the newer v1.7.7 I get this, instead:
> 
>     .: show_in_prompt: unspecified
> 
> Also, if I use the `--all` option, `check-attr` does not show any
> attribute at all.
> 
> I see in the release notes of 1.7.7-rc1 that `check-attr` has been
> changed to allow relative paths to be specified. Maybe this error is
> related to that change.

Indeed, your use case is broken by

f5114a40c0d0276ce6ff215a3dc51eb19da5b420

In fact the support for gitattributes using patterns involving "." was
pretty spotty in v1.7.6 too.  For example,

-------------------------------------------
echo ". foo" >./.gitattributes
git check-attr foo -- . ./ ./. x x/ ./x x/.
.: foo: set
./: foo: unspecified      WRONG
./.: foo: set
x: foo: unspecified       WRONG?
x/: foo: unspecified      WRONG?
./x: foo: unspecified     WRONG?
x/.: foo: set             RIGHT?

-------------------------------------------
echo "/. foo" >./.gitattributes
git check-attr foo -- . ./ ./. x x/ ./x x/.
.: foo: set
./: foo: unspecified      WRONG
./.: foo: set
x: foo: unspecified
x/: foo: unspecified
./x: foo: unspecified
x/.: foo: unspecified

-------------------------------------------
echo ". foo" >x/.gitattributes
git check-attr foo -- . ./ ./. x x/ ./x x/.
.: foo: unspecified
./: foo: unspecified
./.: foo: unspecified
x: foo: unspecified       WRONG?
x/: foo: unspecified      WRONG?
./x: foo: unspecified     WRONG?
x/.: foo: set             RIGHT?

-------------------------------------------
echo "/. foo" >x/.gitattributes
git check-attr foo -- . ./ ./. x x/ ./x x/.
.: foo: unspecified
./: foo: unspecified
./.: foo: unspecified
x: foo: unspecified       WRONG
x/: foo: unspecified      WRONG
./x: foo: unspecified     WRONG
x/.: foo: set

-------------------------------------------

I conclude that this functionality was never really defined correctly,
and you were pretty lucky that your case worked at all :-)

It's not to hard to fix your particular use case.  But for a real fix,
we would need to decide what is the correct behavior in all of the lines
above marked "?"; specifically, should "." match every subdirectory
under a given directory, does it match only the directory containing the
.gitattributes file, or is this construct illegal?

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

  reply	other threads:[~2011-10-05 12:05 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 [this message]
2011-10-05 14:47   ` Gioele Barabucci
2011-10-05 17:38   ` Junio C Hamano
2011-10-05 17:56     ` Gioele Barabucci
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=4E8C481A.1070808@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=gioele@svario.it \
    --cc=git@vger.kernel.org \
    /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 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 NNTP newsgroup(s).