Reducing .gitattributes

Our project’s size gets us an 810KB .gitattributes through subgit. But we only use svn properties on a few hundred files.

Looking at the .gitattributes file, it actually seems largely redundant,

It starts by setting “* text=auto !eol”

but then it literally has a “filename -text” entry for every file in the repository: every cpp, c, h, py, js, json, xml, lua, txt, etc file.

And if you change line-endings in a file, it can take such a long time that the commit is invalid by the time it gets to the pre-commit hook; presumably because it is trying to map all the .gitattributes to svn property settings that none of the files have.

I can understand if this is not something that can easily be automatically detected and controlled, but perhaps you could give us some ability to set default wildcards that it could honor and then only actually need to populate the .gitattributes file with non-defaults, as long as it does the check of “does this file need to be given a distinct property” and so can avoid setting/changing svn props on files that didn’t have them and still don’t need them.

Hi Oliver,

you are completely right, that’s how this feature works and it’s indeed hard to automatically detect and control. I’m afraid though that due to this and also due to internal implementation specifics it’s hardly possible to avoid checking and setting all the files properties in the repository. This process can indeed be a time and resources consuming process and if it affects the performance too much, then probably the best way would be just switching off the EOLs translation setting the translate.eols setting to false. Note, however, that this setting can be changed on the fly and requires full repository rebuild.

1 Like