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

Re: [PATCH/WIP] attr: make attributes depend on file type

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 1, 2011, 07:46 UTC
Message-ID
<4D6CA45F.5000001@drmicha.warpmail.net>
In-Reply-To
<7v39n8jbj2.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 28.02.2011 18:48:
Show 26 quoted lines
> Jeff King <peff@peff.net> writes:
> 
>> The only downside is that it is technically a regression if somebody was
>> using gitattributes for the bizarrely named file "symlink:". It seems
>> pretty unlikely, but possibly we should be carving out a syntactic
>> namespace like:
>>
>>   ^[a-z]+:
>>
>> or even:
>>
>>   ^[a-z]+(=[^:]*)?:
> 
> Or even '^:[a-z]+(=[^,=])?(,[a-z]+(=[^,=])?)*:' to
> 
>  (1) always have some special character at the beginning, to limit the
>      extent of the damage to existing funny pathnames (i.e. to collide
>      your pathname must begin with such a special character).  This also
>      has a nice side effect of making it clear that something special is
>      going on; and
> 
>  (2) allow more than one such special on the line, comma-separated.
> 
> But that is just a small bikeshed.  Other than that, I like what Michael
> and you are aiming for (I am only commenting on the general direction at
> this moment, as I haven't looked at the patch at all yet).

Thanks, Junio, and Jeff, for the helpful comments. I isolated the naming convention (now "symlink:") to a single spot in attr.c so that changing it (then ":symlink:") is always simple while this develops. (I was afraid that the low likelikehood that someone's file names would collide could be too much already.)

Having a standard pattern applied to regular files only is an intended side-effect; more precisely: to non-symlinks right now. We could tighten that to IS_REG, of course, and easily add others (or :other:, :nonreg:).

What I really would need help with is checking all call sites of git_checkattr(), which gained a new mode parameter: I used the proper mode where available (from diff_filespec, e.g., i.e.: taking mode from index or tree) or by looking it up in the fs (using lstat() in builtin/check-attr.c), and I used mode=0 in other cases, assuming that this conveys IS_REG and that we're sure those call sites are about regular files or blobs. I tried to avoid unmotivated lstat().

Michael
Previous: Junio C HamanoNext: Mart Sõmermaa
Message 30 of 32 in “git diff: add option for omitting the contents of deletes”
  1. Mart SõmermaaFeb 26, 2011
  2. Junio C HamanoFeb 26, 2011
  3. Michael J GruberFeb 27, 2011
  4. Mart SõmermaaFeb 27, 2011
  5. Michael J GruberFeb 28, 2011
  6. Mart SõmermaaFeb 28, 2011
  7. Junio C HamanoFeb 27, 2011
  8. Junio C HamanoFeb 27, 2011
  9. Michael J GruberFeb 28, 2011
  10. Jeff KingFeb 28, 2011
  11. Jeff KingFeb 28, 2011
  12. Michael J GruberFeb 28, 2011
  13. Jeff KingFeb 28, 2011
  14. Michael J GruberFeb 28, 2011
  15. Jeff KingFeb 28, 2011
  16. Junio C HamanoFeb 28, 2011
  17. Jeff KingFeb 28, 2011
  18. Junio C HamanoFeb 28, 2011
  19. Junio C HamanoMar 1, 2011
  20. Mart SõmermaaMar 7, 2011
  21. Michael J GruberMar 8, 2011
  22. Junio C HamanoMar 8, 2011
  23. Mart SõmermaaMar 8, 2011
  24. Jeff KingMar 8, 2011
  25. symling diff driver (Was: Re: git diff: add option for omitting the contents of deletes)Michael J Gruber, Feb 28, 2011
  26. Jeff KingFeb 28, 2011
  27. attr: make attributes depend on file typeMichael J Gruber, Feb 28, 2011
  28. Jeff KingFeb 28, 2011
  29. Junio C HamanoFeb 28, 2011
  30. Michael J GruberMar 1, 2011
  31. Mart SõmermaaFeb 28, 2011
  32. Michael J GruberFeb 28, 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.