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

Re: Applying .gitattributes text/eol changes

From
Marc Strapetz <marc.strapetz@syntevo.com>
Date
Jan 11, 2011, 14:02 UTC
Message-ID
<4D2C62DF.20706@syntevo.com>
In-Reply-To
<4D2C4902.4010705@drmicha.warpmail.net>
On 11.01.2011 13:11, Michael J Gruber wrote:
Show 11 quoted lines
> Marc Strapetz venit, vidit, dixit 03.01.2011 18:18:
>> I'm looking for an unobtrusive way to apply (committed) changes for
>> text/eol attributes to the working tree. For instance, after having
>> changed "*.txt eol=crlf" to "*.txt eol=lf", all *.txt files should be
>> converted from CRLF to LF endings. The only advice I found so far is to
>> remove .git/index and do a reset --hard. The disadvantage of this
>> approach is that every file will be touched:
>>
>> - although the content does not change, timestamps will be changed. This
> 
> The bytewise content does change.

The content has only changed for *.txt files, but the timestamps of *all* files are updated. I guess (but didn't verify from code), that in case of missing .git/index, Git freshly writes all working tree files, ignoring already existing files which already have the correct content. Maybe this behavior is by intention and makes sense in some cases. In my case it has adverse effects on IDEs and probably other tools which are monitoring the file system.

Show 8 quoted lines
>> One solution I could think of which might be helpful in other situations
>> as well would be to have an "--unobtrusive" option for reset which would
>> only replace a file if the content has actually been changed.
> 
> How about
> 
> git ls-files \*.txt | xargs touch -a
> git ls-files \*.txt | git checkout
That won't be helpful as it requires me to know what has changed.

-- Best regards, Marc Strapetz ============= syntevo GmbH http://www.syntevo.com http://blog.syntevo.com

Previous: Michael J GruberNext: Michael J Gruber
Message 4 of 11 in “Applying .gitattributes text/eol changes”
  1. Marc StrapetzJan 3, 2011
  2. Marc StrapetzJan 11, 2011
  3. Michael J GruberJan 11, 2011
  4. Marc StrapetzJan 11, 2011
  5. Michael J GruberJan 13, 2011
  6. Marc StrapetzJan 13, 2011
  7. Michael J GruberJan 13, 2011
  8. Marc StrapetzJan 13, 2011
  9. Junio C HamanoJan 13, 2011
  10. Michael J GruberJan 14, 2011
  11. Marc StrapetzJan 14, 2011

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.