Re: How to use git attributes to configure server-side checks?
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Sep 22, 2011, 22:54 UTC
- Message-ID
- <m3vcskqjcv.fsf@localhost.localdomain>
- In-Reply-To
- <4E7AF1AE.5030005@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
> Thanks for the reply and for explaining how the index can(not) be used > for this purpose. But what you propose is not flexible enough for me. > I would like the checking configuration to be *versioned* along with the > code. [...]
[...]
Show 7 quoted lines
> For this to be possible, I would need to determine the git attributes to > apply to a particular file in a particular commit; something like > > git check-attr check-space-indent $SHA1:path/to/file > > This does not seem to be possible today without writing my own code to > crawl and parse the gitattributes files from a particular commit.
Unfortunately it doesn't seem to be there mechanism to query about state of gitattributes at given commit.
There is a slight problem from the UI point of view of git-check-attr, namely that there are _three_ pieces of information: a place to read .gitattributes from (working tree, index, commit), list of attributes to check (or --all) and list of files (list of paths). You can use "--" to separate _two_ pieces of information.
Nb. the ability to read gitattributes from given commit would be useful also for gitweb (the `encoding` gitattribute, etc.).
-- Jakub Narębski