git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Chris Torek <chris.torek@gmail.com>
To: Martin <git@mfriebe.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: Files modified, even after: git reset --hard
Date: Sun, 25 Jul 2021 19:59:03 -0700	[thread overview]
Message-ID: <CAPx1GvdM7CzsbT1SWW9+OPcG9FL7WXQ7YD6aM7P0krujp_OrkQ@mail.gmail.com> (raw)
In-Reply-To: <070f7f5e-0e6c-2edc-1403-9265c810df17@mfriebe.de>

On Sun, Jul 25, 2021 at 6:34 PM Martin <git@mfriebe.de> wrote:
> Actually there is something else.
>
> If a file has line-endings that will change, then
>     git add --renormalize .
>     git commit -m foo
> will commit those files.
>
> But I am now also getting files, that show modified, but that can not be
> committed renormalized (0 lines changed).

I believe (but can't demonstrate) that this is a temporary condition.

Git has a number of cheats to make `git status` and other ops fast.
These cheats *assume* that the committed files, the index copies
of files, and the working tree copies of files all agree in terms of
line endings as coordinated through `core.autocrlf` and `.gitattributes`
settings.

When they *don't* agree, you get phantom differences.  Running
commands like `git diff` show no differences because of these
phantom states.  Eventually this clears up on its own when the
cheats really *do* agree with the settings.  Changing the settings
is what disturbs the cheats.

Git can't do much with `core.autocrlf`, but if it noticed that a
`.gitattributes` file was very recent, and turned off the shortcuts
and did the slower full status checks, updates via `.gitattributes`
would not show phantom changes.  The drawback is that updates
to `.gitattributes` could make `git status` very slow.

Overall this isn't normally a big problem.  It only affects one person
at a time, when they change these settings, and then it clears up
over time...

Chris

  reply	other threads:[~2021-07-26  2:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25 15:04 Files modified, even after: git reset --hard Martin
2021-07-25 15:40 ` Martin
2021-07-25 17:48   ` Martin
2021-07-25 18:39     ` Martin
2021-07-26  0:33       ` Chris Torek
2021-07-26  1:34         ` Martin
2021-07-26  2:59           ` Chris Torek [this message]
2021-07-26 10:31             ` Martin
2021-07-26 11:11               ` Chris Torek
2021-07-26 13:57               ` Martin
2021-07-26 18:21                 ` Philip Oakley
2021-07-26 19:57             ` Martin
2021-07-26 22:03               ` Chris Torek
2021-07-27  0:55                 ` Martin
2021-07-26 10:39           ` Philip Oakley
2021-07-26 12:50             ` Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPx1GvdM7CzsbT1SWW9+OPcG9FL7WXQ7YD6aM7P0krujp_OrkQ@mail.gmail.com \
    --to=chris.torek@gmail.com \
    --cc=git@mfriebe.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).