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

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

From
Jeff King <peff@peff.net>
Date
Feb 28, 2011, 17:30 UTC
Message-ID
<20110228173037.GC24915@sigill.intra.peff.net>
In-Reply-To
<f35b1b4b57a563f57f169602440b3b0abdef5a07.1298906628.git.git@drmicha.warpmail.net>
On Mon, Feb 28, 2011 at 04:26:18PM +0100, Michael J Gruber wrote:
> This is a whether balloon patch (to check whether this balloons or not,
> uhm). Hit it hard, not me ;)
Ouch.
Show 11 quoted lines
> It's part of the way to revive the old idea of making attributes depend
> on file type. I am not following the old path
> 
> pattern is_symlink otherattr
> 
> because that would mean something which looks like an attribute
> (is_symlink) but is not. Instead,
> 
> symlink:pattern attrs
> 
> is to specify attrs for pattern if it is a symlink. So, e.g.,

This is way better than what I proposed. From the user's perspective, it is visually clearer that the symlink bit is part of the selector, and not an attribute. And it syntactically disallows nonsense like:

  pattern is_symlink is_gitlink otherattr

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]+(=[^:]*)?:

And that would later allow stuff like "submodule:" if people wanted to attach specific bits to submodules (though perhaps it is not necessary, because we have the entire separate .gitmodules file). I don't know if there are other non-name elements people would be interested in selecting on. So maybe that is over-engineering.

We also need some way of quoting. Duy has a 1.8.0 proposal to handle this. If we're going to make a syntactic change to gitattributes for this, it should probably be related (since the quoting mechanism is the way you would fix it if you _are_ affected), and should probably follow the same migration mechanism (it looks like there is talk of a "# feature: foo bar" line).

See:
  http://article.gmane.org/gmane.comp.version-control.git/165970

I didn't test, but do we now assume that a pattern like "foo.* diff=bar" will only match when foo is a regular file? I think that would fix stuff like "*.pdf merge=pdf" when there is a symlink named "file.pdf", which I'm pretty sure is currently broken (but did not test).

OTOH, that is yet another behavior change if somebody had something like "foo diff=symlink", which we would be breaking. So perhaps we will need many "# feature" markers to make this right. :)

-Peff
Previous: Michael J GruberNext: Junio C Hamano
Message 28 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.