For what you are trying to do I think you need the following. Note that the eol attribute according to the gitattributes man page may be either "lf" or "crlf". Native is for the core.eol config setting.
Set core.autocrlf false to take explicit control of normalization. Now only files you mark with the text attribute will undergo normalization.
Either set the eol attribute explicitly to lf or crlf for specific filetypes (eg: shell scripts may require lf to work on unix, .csproj files may require crlf on windows). If the eol attribute is unset the value of core.eol should be used. If you set core.eol to crlf then your text files will get crlf endings.
Here is a git test script to illustrate this (run from git/t/):
#!/bin/sh
test_description='check native crlf setting'
. ./test-lib.sh
has_cr() {
tr '\015' Q <"$1" | grep Q >/dev/null
}
test_expect_success 'test native elf' '
printf "*.txt text\n" > .gitattributes
printf "one\r\ntwo\r\nthree\r\n" > filedos.txt
printf "one\ntwo\nthree\n" > fileunix.txt
git init &&
git config core.autocrlf false &&
git config core.eol crlf &&
git add . &&
git commit -m "first" &&
rm file*.txt &&
git reset --hard HEAD &&
has_cr filedos.txt && has_cr fileunix.txt
'
test_done
With the above config and attributes, with Git for Windows 1.8.0 both files are normalized after the reset and contain crlf line endings.
Where a bug may exist is that if the core.eol variable is left unset (or set to 'native') this test fails as the files are normalized to lf line endings in this case. The path you have mentioned above does not help this situation either. So from my testing, you must explicitly set core.eol to crlf to have your planned approach be successful.
rm .git/index
thengit reset
but nothing changed - I had already committed the gitattributes - anyway the strange thing is thecheckout
should checkout windows line endings - what do I miss ? The gitattributes I wrote seems OK, no ? – Hooeygit add --renormalize .
: See [my other answer ](https://mcmap.net/q/11222/-git-how-to-renormalize-line-endings-in-all-files-in-all-revisions). – Brewhouse