git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git attributes ignored for root directory

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Oct 5, 2011, 12:05 UTC
Message-ID
<4E8C481A.1070808@alum.mit.edu>
In-Reply-To
<4E8B55FB.1050203@svario.it>
On 10/04/2011 08:52 PM, Gioele Barabucci wrote:
Show 25 quoted lines
> 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/
Previous: Gioele BarabucciNext: Gioele Barabucci
Message 2 of 13 in “Git attributes ignored for root directory”
  1. Gioele BarabucciOct 4, 2011
  2. Michael HaggertyOct 5, 2011
  3. Gioele BarabucciOct 5, 2011
  4. Junio C HamanoOct 5, 2011
  5. Gioele BarabucciOct 5, 2011
  6. Junio C HamanoOct 5, 2011
  7. Gioele BarabucciOct 5, 2011
  8. Junio C HamanoOct 5, 2011
  9. Michael HaggertyOct 12, 2011
  10. Junio C HamanoOct 12, 2011
  11. Gioele BarabucciOct 13, 2011
  12. Johannes SixtOct 13, 2011
  13. Junio C HamanoOct 13, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.