git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: wrong handling of text git attribute leading to files incorrectly reported as modified

From
Torsten Bögershausen <tboegi@web.de>
Date
Apr 11, 2014, 20:38 UTC
Message-ID
<534852D4.5070608@web.de>
In-Reply-To
<E8A9F28E-FF68-4899-B02C-DB7A2C66F38A@ammeter.ch>
On 2014-04-11 22.20, Frank Ammeter wrote:
Show 10 quoted lines
> I’m not a git expert and this might be the wrong place to ask this question,
> so please send me somewhere else if I’m in the wrong place.
> 
> I asked the same question on stack overflow, but didn’t get any response:
> http://stackoverflow.com/questions/22823004/files-incorrectly-reported-modified-git-attributes-buggy-leading-to-inconsist
> 
> If a file is committed with crlf line endings with the text attribute unset in the working tree, but the text attribute is set in the repo, the file will be incorrectly shown as modified - for all users checking out the file.
> Resetting or manually modifying the file will not help - The only remedy is to commit the .gitattributes with the text attribute set for the file.
> 
> Wouldn’t it be better to only consider the checked-in gitattributes instead of the attributes in the working tree?

No. If you change stuff in your working tree (and .gitattributes is a part of the working tree) how should Git know what you want? The primary assumption is that you know what you are doing in the working tree.

> Is this a bug in git handling gitattributes or is this wrong usage? 
I thinkk No, yes.

If it is wrong usage, is it documented anywhere? Please have a look here: https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

And if you think that the documentation can be improved, please feel free to send suggestions.

A simple "git diff" is a good start, and a patch with a commit message is even better.
Previous: Frank AmmeterNext: Frank Ammeter
Message 2 of 8 in “wrong handling of text git attribute leading to files incorrectly reported as modified”
  1. Frank AmmeterApr 11, 2014
  2. Torsten BögershausenApr 11, 2014
  3. Frank AmmeterApr 12, 2014
  4. Brandon McCaigApr 15, 2014
  5. Junio C HamanoApr 15, 2014
  6. Frank AmmeterApr 16, 2014
  7. Junio C HamanoApr 16, 2014
  8. Holger HellmuthApr 16, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.