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

Re: APFS, mmap, and git diff reporting no changes when there are changes?

From
Johannes Sixt <j6t@kdbg.org>
Date
Nov 11, 2026, 07:20 UTC
Message-ID
<8b881ed0-f30f-41af-9e59-f4e93006545a@kdbg.org>
In-Reply-To
<avJLR6EdZ4OYmTpj@fruit.crustytoothpaste.net>
Am 09.11.26 um 23:38 schrieb brian m. carlson:
Show 17 quoted lines
> On 2026-11-09 at 22:05:55, Harold Hunt wrote:
>> One could also argue that this is Apple's bug or deficiency.  But that
>> could take months / years to resolve?
> 
> This behaviour is allowed by POSIX:
> 
>     The last data modification and last file status change timestamps of
>     a file that is mapped with MAP_SHARED and PROT_WRITE shall be marked
>     for update at some point in the interval between a write reference
>     to the mapped region and the next call to msync() with MS_ASYNC or
>     MS_SYNC for that portion of the file by any process.
> 
> However, Git relies on the operating system to reflect an accurate
> modification time.  If you write files to disk with mmap, then you're
> responsible for calling msync() in a timely manner.  However, as I said,
> that's extremely improvident for things like files in the working tree,
> which is why text editors don't use mmap.

Not to mention that our mmap emulation for Windows cannot reproduce the Linux behavior (timely update of timestamps) and is more like the macOS behavior (delayed update of timestamps). We cannot have an accurate (atomic) msync emulation, either, because not even FlushViewOfFile[1] updates the timestamp.

[1] https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-flushviewoffile

-- Hannes
Previous: brian m. carlson
Message 3 of 3 in “APFS, mmap, and git diff reporting no changes when there are changes?”
  1. Harold HuntNov 9, 2026
  2. brian m. carlsonNov 9, 2026
  3. Johannes SixtNov 11, 2026

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.