Re: A puzzle: reset --hard and hard links
- From
- Michael Herrmann <michael@herrmann.io>
- Date
- Jan 24, 2022, 13:48 UTC
- Message-ID
- <CABrKpmBFrrWgBh7QAOX35zQr_e+LC1E6Jn5FKb_XP-7bew9Hkg@mail.gmail.com>
- In-Reply-To
- <CABrKpmASHgBwPYgKnO2ZZRVVxMti=NFaxw6cBV=pst0xpVZYGA@mail.gmail.com>
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`.
Without 2), Git severs the hard link. With 2), the hard link is preserved.
Reproduction steps ("Test script") and further info: https://github.com/brave/brave-browser/issues/20316#issuecomment-1020054082
This occurs for me on Debian 10 & 11, as well as Git 2.30.2 and 2.20.1.