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

Re: Cannot checkout after setting the eol attribute

From
Ben Boeckel <mathstuf@gmail.com>
Date
Aug 23, 2017, 21:09 UTC
Message-ID
<20170823210944.GA32462@megas.kitware.com>
In-Reply-To
<20170823194315.GA29237@tor.lan>
On Wed, Aug 23, 2017 at 21:43:15 +0200, Torsten Bögershausen wrote:
Show 6 quoted lines
> git reset does it's job - please see below.
> 
> The problem is that we need a "git commit" here.
> After applying .gitattributes, it may be neccessary to "normalize" the
> files. If there is something in the documentation, that can be
> improved, please let us know.
I'll have a patch up shortly.
Show 20 quoted lines
> On Tue, Aug 22, 2017 at 03:44:41PM -0400, Ben Boeckel wrote:
> > The fact that plumbing is necessary to dig yourself out of a hole of the
> > `eol` attribute changes points to something needing to be changed, even
> > if it's only documentation. Could Git detect this and message about it
> > somehow when `git reset` cannot fix the working tree?
> 
> The thing is, that the working tree is "in a good state":
> We want "dos" with CRLF, and that is what we have.
> There is nothing that can be improved in the working tree.
> What needs to be fixed, is the index. And that needs to be done with
> "git add" "git commit."
> As Junio pointed out, the read-tree is not ideal
> (to fix a single file in a possible dirty working tree)
> 
> In your case it looks like this:
> 
>     echo "dos eol=crlf" > .gitattributes
>     git add .gitattributes &&
>     git rm --cached dos && git add dos &&
>     git commit

In this case, just adding the file should work: the file is on-disk as intended and adding the file should normalize the line endings when adding it into the index (basically, just `git add dos` should be required to make the index look like it should).

Show 5 quoted lines
> > Or maybe it could at least exit with failure instead of success?
> 
> I don't know.
> It -may- be possible to add a warning in "git reset".
> I can have a look at that...
Thanks.
--Ben
Previous: Torsten BögershausenNext: Junio C Hamano
Message 5 of 15 in “Cannot checkout after setting the eol attribute”
  1. Ben BoeckelAug 22, 2017
  2. Torsten BögershausenAug 22, 2017
  3. Ben BoeckelAug 22, 2017
  4. Torsten BögershausenAug 23, 2017
  5. Ben BoeckelAug 23, 2017
  6. Junio C HamanoAug 22, 2017
  7. Documentation: mention that `eol` can change the dirty status of pathsBen Boeckel, Aug 23, 2017
  8. Ben BoeckelAug 23, 2017
  9. Torsten BögershausenAug 24, 2017
  10. Ben BoeckelAug 30, 2017
  11. Junio C HamanoAug 30, 2017
  12. Ben BoeckelAug 31, 2017
  13. Documentation: mention that `eol` can change the dirty status of pathsBen Boeckel, Aug 30, 2017
  14. Documentation: mention that `eol` can change the dirty status of pathsBen Boeckel, Aug 31, 2017
  15. Torsten BögershausenAug 31, 2017

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.