Re: A puzzle: reset --hard and hard links
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 24, 2022, 18:07 UTC
- Message-ID
- <xmqqk0ep57ou.fsf@gitster.g>
- In-Reply-To
- <CABrKpmBFrrWgBh7QAOX35zQr_e+LC1E6Jn5FKb_XP-7bew9Hkg@mail.gmail.com>
Michael Herrmann <michael@herrmann.io> writes:
Show 6 quoted lines
> I now believe this is a bug in Git because calling `git status` fixes > the problem. > > 1) Create a hard link to a file in a Git repo. > 2) Call `git status`. > 3) Call `git reset --hard`.
It is merely because you helped Git to realize that there is no need to change the contents of hte file with "reset --hard".
With another step 1.5 "append a line to the file in question", git should severe the link, I would think, as at that point, to revert the contents of the file in question to its pristine state, it needs to modify it.