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

Logical inconsistency in git reset

From
Vvvs <vvs009@gmail.com>
Date
Apr 23, 2017, 16:01 UTC
Message-ID
<CAM1zWBtfgHT=pT0pidQo1HD=DfrXLG3gNaUvs0vZKvYfG1BHFw@mail.gmail.com>
Dear list

Like it was suggested on git-users list I'm forwarding the original message here.

I found out that "git reset --hard" produced different outcome depending on current index content, i.e. when there is no entry for a file in working tree it actually changed that file. While on the contrary, if you use "git reset --mixed" right before that, the file won't be touched. This affects make, which thinks that the file was changed.

More detailed discussion and test cases can be found here: https://groups.google.com/forum/?hl=en#!topic/git-users/9ziZ6yq-BfU

I could just add to that argument that this issue is certainly looks like a logical inconsistency to an average user. The git operations are checking an index entry for the file in working tree but they doesn't fill that entry in the first place. Shouldn't this be considered as a kind of uninitialized pointer problem? And there is that useful abstraction that --hard should include --mixed semantics.

Message 1 of 1 in “Logical inconsistency in git reset”
  1. vvsApr 23, 2017

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.