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

Re: [PATCH v1] dir.c: don't flag the index as dirty for changes to the untracked cache

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 13, 2018, 09:57 UTC
Message-ID
<CACsJy8BWh=e6_Sz20djd5ixxm_Pwa43OHNzXrBatm14k0P+qxQ@mail.gmail.com>
In-Reply-To
<d1371a6c-2b30-515a-372e-4fea9bc09c43@gmail.com>
On Tue, Feb 13, 2018 at 12:57 AM, Ben Peart <peartben@gmail.com> wrote:
Show 14 quoted lines
>> Another case that could touches a lot of directories over time is
>> switch trees (e.g. "git checkout master" then "checkout next" or worse
>> "checkout v1.0").
>
>
> You're example above makes me wonder if you understand what my patch is
> doing.  If the index is flagged as dirty for _any_ reason, the entire index
> is written to disk with the latest information - including the updated
> untracked cache and all other extensions.  So in your checkout examples
> above, the index will still get written to disk with the updated untracked
> cache extension.  There would be zero change in behavior or performance.
> The _only_ time the index is not written to disk after my patch is if there
> were no other changes to the index.  In my experience, that is only status
> calls.

The untracked cache is updated and does get written down, but it's not "repaired" unless you have called read_directory() before the index is written. Though paths that hit untracked_cache_invalidate_path() will continue on slow path until you call read_directory() and write down. I don't think "git checkout" calls read_directory. There are some commands, like "git add", that update the index and call read_directory() at the same time. So yes I was wrong, the untracked cache can be repaired sometimes, not never repaired.

We do try to improve performance at "git checkout" and a couple other "slow" commands though (e.g. repair cache tree), perhaps we can do the same for untracked cache. Though the cost of updating untracked cache is potentially much higher than cache tree.

-- 
Duy
Previous: Ben PeartNext: Jeff King
Message 14 of 18 in “dir.c: don't flag the index as dirty for changes to the untracked cache”
  1. dir.c: don't flag the index as dirty for changes to the untracked cacheBen Peart, Feb 5, 2018
  2. Junio C HamanoFeb 5, 2018
  3. Ben PeartFeb 6, 2018
  4. Brandon WilliamsFeb 5, 2018
  5. Ben PeartFeb 6, 2018
  6. Duy NguyenFeb 6, 2018
  7. Duy NguyenFeb 6, 2018
  8. Duy NguyenFeb 7, 2018
  9. Ben PeartFeb 7, 2018
  10. Junio C HamanoFeb 6, 2018
  11. Ben PeartFeb 7, 2018
  12. Duy NguyenFeb 12, 2018
  13. Ben PeartFeb 12, 2018
  14. Duy NguyenFeb 13, 2018
  15. Jeff KingFeb 8, 2018
  16. Junio C HamanoFeb 28, 2018
  17. Jeff KingMar 1, 2018
  18. Ben PeartMar 1, 2018

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.