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
Ben Peart <peartben@gmail.com>
Date
Feb 6, 2018, 01:39 UTC
Message-ID
<6ff2ecb4-7e37-3b06-3722-cccec2329934@gmail.com>
In-Reply-To
<xmqqd11j9mx2.fsf@gitster-ct.c.googlers.com>
On 2/5/2018 3:55 PM, Junio C Hamano wrote:
Show 32 quoted lines
> Ben Peart <benpeart@microsoft.com> writes:
> 
>> The untracked cache saves its current state in the UNTR index extension.
>> Currently, _any_ change to that state causes the index to be flagged as dirty
>> and written out to disk.  Unfortunately, the cost to write out the index can
>> exceed the savings gained by using the untracked cache.  Since it is a cache
>> that can be updated from the current state of the working directory, there is
>> no functional requirement that the index be written out for every change to the
>> untracked cache.
>>
>> Update the untracked cache logic so that it no longer forces the index to be
>> written to disk except in the case where the extension is being turned on or
>> off.  When some other git command requires the index to be written to disk, the
>> untracked cache will take advantage of that to save it's updated state as well.
>> This results in a performance win when looked at over common sequences of git
>> commands (ie such as a status followed by add, commit, etc).
>>
>> After this patch, all the logic to track statistics for the untracked cache
>> could be removed as it is only used by debug tracing used to debug the untracked
>> cache.
>>
>> Signed-off-by: Ben Peart <benpeart@microsoft.com>
>> ---
>>
> 
> OK, so in other words (note: not a suggestion to use different
> wording in the log message; just making sure I got the motivation
> behind this change correctly), without this new environment
> variable, changes to untracked cache alone (due to observed changes
> in the filesystem) does not count as "in-core index changed so we
> need to write it back to the disk".
> 
Correct
Show 7 quoted lines
> That makes sense to me.
> 
> Is it envisioned that we want to have similar but different "testing
> only" behaviour around this area?  If not, this environment variable
> sounds more like "force-flush untracked cache", not "test untracked
> cache", to me.
> 

Many of the tests make a change and then verify that the on disk structure was updated correctly. This was the simplest way to keep those tests functioning. I don't imagine this would be used for anything other than enabling the tests. I hate naming so am happy to name it which ever you think is best. :)

Show 8 quoted lines
>> +GIT_TEST_UNTRACKED_CACHE=true
>> +export GIT_TEST_UNTRACKED_CACHE
>> +
>>   sync_mtime () {
>>   	find . -type d -ls >/dev/null
>>   }
>>
>> base-commit: 5be1f00a9a701532232f57958efab4be8c959a29
Previous: Junio C HamanoNext: Brandon Williams
Message 3 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.