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

Re: speed of git reset -- file

From
Jeff King <peff@peff.net>
Date
Jun 1, 2011, 19:58 UTC
Message-ID
<20110601195831.GA30070@sigill.intra.peff.net>
In-Reply-To
<7v62oqignm.fsf@alter.siamese.dyndns.org>
On Tue, May 31, 2011 at 04:39:25PM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> "git reset" has always refreshed the index. If somebody _really_ wants to
> introduce a slight inconsistency to "git reset" so that only in "per-path"
> mode it doesn't refresh, the call to refresh_index() can easily be removed
> from update_index_refresh(). There is no "we end up having to".
> 
> IOW, we refresh by choice, design and inertia ;-).

Ah, yeah, I really wasn't thinking of the fact that refreshing is a user-facing operation. These days most of the porcelain commands will do it for you automatically, so it's easy to forget.

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. Lots of other commands will end up stat'ing everything, anyway. Users with giant repos or slow stat calls are probably better off using assume-unchanged, which would help this and many other situations.

-Peff
Previous: Junio C HamanoNext: Joey Hess
Message 8 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.