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

On 26/07/2021 02:33, Chris Torek wrote:
> On Sun, Jul 25, 2021 at 11:43 AM Martin <git@mfriebe.de> wrote:
>>>>> [Files show up as every-line-modified]
>>> [and] git replace has a weird effect.
>> Ok, it seem that
>>     git switch
>> simple did not update the file.
> 
...
> Let's suppose, just for convenience for now, that the files in the
> repository right now actually do have CRLF line endings.
> 
> Let's suppose further that you ask that Git ensure that your
> *working tree* copies of each file contain CRLF line endings.
> 
Yes, I accept that decision.
I figured that is the reason why they show modified.

Not a problem. Until I am in the middle of a rebase, and i cannot run 
(after a conflict)
   git rebase --continue

The modified files are not part of the original series of commits. they 
are just random files from somewhere else in the tree.
I can not reset/restore them.
So I must now "git add" files entirely unrelated to continue rebasing.
Well or apparently change my config for the duration of the rebase.


> As for "git replace", you've figured the rest out already: if
> you use git replace to make Git use new, LF-only line ending
> objects (file data), Git is now happy about the internal storage.
> It just takes some shuffling-about to cause these replaced objects
> to wind up in Git's *index* AKA *staging area*.

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).

And that happens with or without refs/replaces.

Any idea how to find out why git thinks they are modified?
    git status --porcelain=v2
shows that the file mode is not modified. Only the file in the working tree.
But "git diff" shows nothing (no summary neither). And renormalizing has 
no effect.



In fact I started running the following
   git rev-list --reverse main | xargs -L 1 sh -c 'git switch --detach 
-q -f $0 ; a=$( git status -uno --porcelain=v1 ) ; if [ "$a" != "" ]; 
then git log --oneline -n1 $0 ; echo $a; fi '

That is, switch to each revision in main (or master). And check if any 
file is reported modified.

I just tried that on the gdb git. Plenty of files.
Also other repros have shown modified files.
(I have not yet tried the "git sources" git...

If I then manually switch to some of the commits that had modified files 
shown, and I do not switch to all the commits before, then sometimes 
there are no modified files.

git fsck has a few dangling commits
git gc made no difference.


  reply	other threads:[~2021-07-26  1:34 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 [this message]
2021-07-26  2:59           ` Chris Torek
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=070f7f5e-0e6c-2edc-1403-9265c810df17@mfriebe.de \
    --to=git@mfriebe.de \
    --cc=chris.torek@gmail.com \
    --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).