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 7, 2018, 10:59 UTC
Message-ID
<CACsJy8CS6QwAc9=i9JhW3RhLqYsfPM_OWSJ-DCvEAftOKDWs2w@mail.gmail.com>
In-Reply-To
<CACsJy8C+9Det0zF4+HZ6TL36aCFgboEh4=3yrEk5WvyUD30Drw@mail.gmail.com>
On Tue, Feb 6, 2018 at 7:55 PM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 30 quoted lines
> On Tue, Feb 6, 2018 at 7:27 PM, Duy Nguyen <pclouds@gmail.com> wrote:
>> On Tue, Feb 6, 2018 at 8:48 AM, Ben Peart <peartben@gmail.com> wrote:
>>> With the new behavior, making a change in dir1/, then calling status would
>>> update the dir1/ untracked cache entry but not write it out. On the next
>>> status, git would detect the change in dir1/ again and update the untracked
>>
>> Thing only missing piece here I would add is, this dir1/ detection is
>> done by watchman. We have to contact watchman and ask the set of
>> changed paths since $TIME where $TIME is the last time we updated
>> untracked cache and invalidate those paths in core. Then it should
>> work correctly. I checked the watchman query in the fsmonitor hook and
>> I think it's correct so far.
>
> No I think I'm wrong. And worse, I think the interaction between FSNM
> and UNTR extension is broken. This is partly from me guessing how
> fsmonitor works so I may be double-wrong.
>
> UNTR extension is supposed to cover the untracked state at timestamp
> $X. Where $X is stored in FSNM extension. Correct?
>
> When fsmonitor is used and read_directory() is executed (at timestamp
> $Y), we ask watchman "what's new on worktree since $X?"). We get the
> list, we invalidate relevant directories so we can see new untracked
> entries (or lack of old untracked entries). We write FSNM with
> timestamp $Y down. We may or may not write UNTR down because of this
> patch, but let's suppose we do. All is good. UNTR now records the
> state at $Y. FSNM says $Y. This is how it works (when there's no bugs)
>
> UNTR extension is only updated when read_directory() is called. It
> does not always happen. FSNM is updated all the time (almost at every

I was indeed doubly wrong. When FSMN is read, it does make calls to invalidate stuff in untracked cache data structure. If the index is written down (with updated FSMN extension and timestamp) then the UNTR extension, which is generated from in-core untracked data structure, also reflects the damages by the changed paths so next time even if those changed paths are not reported again (between $Y and $Z below), it's fine.

All is good in the world again :)
Show 7 quoted lines
> git command since most of them needs to read index, many write it
> down) with new timestamp. Suppose FSNM now records timestamp $Z, UNTR
> still records the state at $Y because in the last index update,
> read_directory() is not executed. 4 files have been added between $Y
> and $Z. When we ask watchman "what's new since $Z?" we will not see
> those files, so we don't invalidate relevant directories and
> read_directory() will not see those files.
-- 
Duy
Previous: Duy NguyenNext: Ben Peart
Message 8 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.