git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Files modified, even after: git reset --hard

From
MMartin <git@mfriebe.de>
Date
Jul 27, 2021, 00:55 UTC
Message-ID
<3cfcbbd4-0b26-dedf-f5f2-85caebcb75da@mfriebe.de>
In-Reply-To
<CAPx1Gvey1uSr58Uf7VpC0c6J+R0tUP=VUP_dGmv_yVO-CwmvXg@mail.gmail.com>
On 27/07/2021 00:03, Chris Torek wrote:
Show 7 quoted lines
> On Mon, Jul 26, 2021 at 12:57 PM Martin <git@mfriebe.de> wrote:
>> Is it possible that those cheats also look at the "replaced" (rather
>> than the "replacement") commit(s)?
> 
> [1]: https://git-scm.com/docs/racy-git/en
> [2]: https://web.archive.org/web/20101214222704/http://msdn.microsoft.com/en-us/library/14h5k7ff(v=vs.80).aspx
> 

Thanks for the info. I still think there is something wrong. So I made a simple testcase

https://github.com/User4martin/testrep.git git fetch origin 'refs/replace/*:refs/replace/*'

All tested on linux. (Though git version 2.25.1)
git init test

FILE .gitattributes foo -text

FILE foo AAAAA

git add .gitattributes foo git commit -m A

modify foo (real content modify) add / commit -m B modify foo (real content modify) add / commit -m C

switch -d <A> modify foo to be the same as commited to "C" add / commit -m A2

git show
- get the old and new hash for the blob containing foo
git replace old new

Now commit A has the same content in foo as commit C (we are currently at the detached commit A2)

git switch <C> git status // all fine

git switch <A> git status => foo is modified git diff => no diff

So I would say, it is not autorclf, or line endings in this case.

I do not know, if the above can be caused by "raciness". But it appears to only(?) happens if a replace is in place.

So at this point my guess would be, that when the switch is done, at some point something looks at the original blob, even though it is meant to look at the replacement.

Previous: Chris TorekNext: Philip Oakley
Message 14 of 16 in “Files modified, even after: git reset --hard”
  1. MartinJul 25, 2021
  2. MartinJul 25, 2021
  3. MartinJul 25, 2021
  4. MartinJul 25, 2021
  5. Chris TorekJul 26, 2021
  6. MartinJul 26, 2021
  7. Chris TorekJul 26, 2021
  8. MartinJul 26, 2021
  9. Chris TorekJul 26, 2021
  10. MartinJul 26, 2021
  11. Philip OakleyJul 26, 2021
  12. MartinJul 26, 2021
  13. Chris TorekJul 26, 2021
  14. MartinJul 27, 2021
  15. Philip OakleyJul 26, 2021
  16. MartinJul 26, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.