All of lore.kernel.org
 help / color / mirror / 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: Mon, 26 Jul 2021 04:11:49 -0700	[thread overview]
Message-ID: <CAPx1GvfH0Rqz238GUByBGkrRK8UeBpF3-1XvW_M66_w6DVgYFA@mail.gmail.com> (raw)
In-Reply-To: <f454bf5b-c5ff-4140-02a8-b02dcd35c6b9@mfriebe.de>

I don't have Windows and hence cannot test your exact
situation (which I understand to be:

    `core.autocrlf` set to `true`

and of course "using Windows"). I will repeat that I think
setting `core.autocrlf` to `true` is a bad idea, though.

In the meantime:

On Mon, Jul 26, 2021 at 3:31 AM Martin <git@mfriebe.de> wrote:
> origin  git://sourceware.org/git/binutils-gdb.git (fetch)

I cloned this repository so as to be able to obtain its commits.

> fsck had some dangling commits, I did a "git gc --aggressive".

(Dangling commits are irrelevant and unimportant: there's no need
to do this.)

> Switching to a far away commit
> git switch -f --detach master
> git rev-list master | wc -l
> 93917

The actual hash ID of the commit would be potentially useful here
(whether it's really useful would depend on whether I have or can
obtain that commit).

I do see that commit 16788ca9fd7352b2b20f4b11111283a8cd4212e2
removed various `Makefile.dos` files, including one mentioned
below (`bfd/Makefile.dos`).  That's the only file name I looked at
specifically for this kind of operation initially (I checked another
just now and it too went away in that commit).

> ... Then switching to  (this is on master branch)
> git switch -f --detach a362ee23634

The hash ID is all that matters: branch names are irrelevant here.

This commit contains a `bfd/Makefile.dos`.  The actual line
endings in this file are LF-only.

> git status --porcelain=v2
> 1 .M N... 100644 100644 100644 9e677a52ae690808165993a0f3f17ac49e3969df
> 9e677a52ae690808165993a0f3f17ac49e3969df bfd/Makefile.dos

This is also useful:

 * The `.M` means that the committed copy of the file matches
   the index copy, while the index copy does not match the working
   tree copy (presumably because the working tree copy has had
   its line endings changed to CRLF).
 * The `N...` means that this is not a submodule.
 * The three `100644`s mean that the file is mode 100644 in
   the commit, the index, and the working tree.
 * The two hash IDs are the blob object hash IDs for the committed
   and index copies of the file data; these match.
 * Last, we have the file's name in the index.

The same pattern seems to repeat for the remaining files.

These "Makefile.dos" files seem to be hardly ever touched,
in any commit, so these four files are likely not to be swapped
out by `git checkout` or `git switch` operations.

> My question is are there any plumbing commands, that could allow me to
> look further at it.

The simplest is to get the raw hash ID of any existing Git-ized object,
and use `git cat-file -p <hash>` on that object.  Since `git cat-file` has
no idea whether the data are to be treated as text or binary (in this
case where there is no path name and no `--textconv` flag),it just
writes out the raw text.  You must, however, make sure that the output
from this command is not mangled by some other tool (e.g., some
Windows editor "helpfully" changing LF-only to CRLF).

Note that `git ls-tree`, with the `-r` (recursive) option, allows you
to inspect the raw hash IDs of committed files by their path names.

Chris

  reply	other threads:[~2021-07-26 11:12 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
2021-07-26 10:31             ` Martin
2021-07-26 11:11               ` Chris Torek [this message]
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

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

  git send-email \
    --in-reply-to=CAPx1GvfH0Rqz238GUByBGkrRK8UeBpF3-1XvW_M66_w6DVgYFA@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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.