Re: How to use git attributes to configure server-side checks?
From: Jakub Narebski <hidden>
Date: 2016-06-15 22:52:05
Michael Haggerty [off-list ref] 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. [...]
[...]
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