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

Re: [RFC PATCH (GIT-GUI/CORE BUG)] git-gui: Avoid an infinite rescan loop in handle_empty_diff.

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 24, 2009, 03:29 UTC
Message-ID
<7v7i4lpekb.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200901240052.58259.angavrilov@gmail.com>
Alexander Gavrilov <angavrilov@gmail.com> writes:
>     $ git config core.autocrlf true

This operation, when done in an already populated work tree, invalidates all the state that is cached in the index, and you would need to adjust things to the altered reality caused by this operation before doing anything else. There are different reasons you would want to flip the configuration after you have files in your work tree, and depending on the situation, the correct adjustment would differ.

You may have started a project in this repository, your work tree files all have CRLF endings that is your platform convention, and after adding the files to the index (but before making a commit) you may have realized that you would want to keep your project cross platform, and that may be the reason you are flipping the configuration. If that is the case, your index is already contaminated with CRLF, but your files have the line ending that is correct (for you). You would want to remove the index and "add ." to stage everything again before proceeding, to have the autocrlf mechanism to correct the line endings in the repository objects.

This would be the best case in one extreme.

On the other hand, you may have cloned a cross platform project from elsewhere (in other words, your objects and the index have the correct line ending), the checkout was done without autocrlf and it does not match the local filesystem convention to use CRLF, and that may be the reason you are flipping the configuration. If that is the case, before making any changes to the work tree files, the right adjustment would be to remove the index, and "reset --hard" to force a checkout that follows your autocrlf settings, so that the work tree files are corrected.

This would be the best case in the other end of the extreme.
And there will be different cases in between these extremes.

I think clueful users who flips the configuration from the command line would know all of the above, know what they want and can tell what the best course of action would be, but I at the same time wonder if git-gui should (and if so, can) offer a simple and safe way to help this process from others.

Previous: Keith Cascio
Message 3 of 3 in “git-gui: Avoid an infinite rescan loop in handle_empty_diff.”
  1. git-gui: Avoid an infinite rescan loop in handle_empty_diff.Alexander Gavrilov, Jan 23, 2009
  2. Keith CascioJan 24, 2009
  3. Junio C HamanoJan 24, 2009

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.