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

Re: speed of git reset -- file

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 1, 2011, 20:51 UTC
Message-ID
<7vvcwpff6o.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110601195831.GA30070@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> So implementing the "optimization" to drop the refresh here doesn't seem
> worth it. It inroduces an awful inconsistency, and it probably isn't
> saving much in practice...

You could make it less inconsistent by introducing core.autorefreshindex for people who _do_ care about the latency. We already have a precedent in diff.autorefreshindex and the new configuration would supercede it.

Usually we refresh the cached lstat information in the index at strategic places so that later operations do not have to pay the penalty, but at the same time, the higher level commands that want to make sure they are not fooled by stale lstat differences do refresh the index themselves anyway, so leaving cached stat information stale is not exactly the end of the world.

All the high-level commands like "reset" that do _not_ absolutely need to refresh the index for them to work, but do refresh the index to help later invocation of other commands, could be taught to pay attention to the core.autorefreshindex. After many operations the users usually do not see changes from diff-files, people who set this to false will see phantom changes due to stale cached lstat information, and they will see them consistently. They know exactly when having up-to-date lstat information in the index really matters, and they will run "update-index --refresh" themselves when needed.

I however personally doubt it would be worth the effort. The _only_ person who complained about this doesn't even use "update-index --refresh" but uses "git status", which does more than refreshing the index, and seems to think the extra latency coming from the overhead is acceptable.

So...
Previous: Joey Hess
Message 17 of 17 in “speed of git reset -- file”
  1. Joey HessMay 31, 2011
  2. Jeff KingMay 31, 2011
  3. Junio C HamanoMay 31, 2011
  4. Jeff KingMay 31, 2011
  5. Matthieu MoyMay 31, 2011
  6. Nguyen Thai Ngoc DuyJun 1, 2011
  7. Junio C HamanoMay 31, 2011
  8. Jeff KingJun 1, 2011
  9. Joey HessJun 1, 2011
  10. Jeff KingJun 1, 2011
  11. Joey HessJun 1, 2011
  12. Jeff KingJun 1, 2011
  13. Joey HessJun 1, 2011
  14. Jeff KingJun 2, 2011
  15. Joey HessJun 2, 2011
  16. Joey HessJun 2, 2011
  17. Junio C HamanoJun 1, 2011

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.