I'm trying to address files without extensions in .gitattributes:
* text=auto
*. eol=lf
.py eol=lf
*. clearly doesn't help. git check-attr --all -- ./foo outputs:
./foo: text: auto
How can this be done?
I think you have to set the value you want to all files, then remove the attribute for files with extension:
* text=auto eol=lf
*.* -eol # or set another default value
*.py eol=lf
It will give the result:
$ git check-attr --all -- file
file: text: auto
file: eol: crlf
$ git check-attr --all -- foo.py
foo.py: text: auto
foo.py: eol: lf
$ git check-attr --all -- bar.txt
bar.txt: text: auto
bar.txt: eol: unset
eol=lf only on *. and *.py. Not on *.*. That's why the question was asked.This looks like a missing facility in .gitattributes.
In gitignore, you can use the ! operator, as mentioned in How do I add files without dots in them (all extension-less files) to the gitignore file? but gitattributes does not support !.
It's not clear how ! would work in .gitattributes: they may need to add an 'exclude' operation of some sort.
not/valid/yet/* exclude=.
*.means files that have a period as their last character. "Extensions" is a silly human notion, not something computers do. :-) So a file namedfoois just "a file namedfoo" here, there's no notion of whether it has any extension. (This used to be different in the old DOS 8.3 fliename days, in MS-DOS and CP/M at least, where the names really were stored as "name, extension". But that stopped being true by the 1990s.).gitattributesin the first place. But Git doesn't have regular expression support on paths.