#733251 'git commit' should catch files needing update due to new attributes

Package:
git
Source:
git
Description:
fast, scalable, distributed revision control system
Submitter:
Jonathan Nieder
Date:
2013-12-27 19:39:06 UTC
Severity:
wishlist
#733251#5
Date:
2013-12-27 19:35:42 UTC
From:
To:
Suppose I add the following line to .gitattributes:

	*.java text

Meanwhile, the repo has had one .java file with CRLF line endings for
a while (a mistake, but it happens).  Because the 'text' attribute
promises that the file should have LF endings when checked in, unless
I update that file, anyone cloning the repository on Windows will
see it as modified --- if they were to add the unchanged file with
"git add" and commit then the line endings would be fixed.

Best for me to fix the line ending now in the same commit as I add
.gitattributes.  Unfortunately (especially if I do not use Windows) it
is likely I will not notice.  Could "git commit" help?

I'm imagining an error when attempting to commit an attribute change
that promises files will only contain LF endings and they don't.  It
would still be possible to commit such a change by running git commit
again with --force.

Noticed in the context of https://github.com/MovingBlocks/Terasology's
engine/src/main/java/org/terasology/math/Matrix4i.java by Mike
Kienenberger on #git.