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

[PATCH/RESEND v6 0/2] read-cache: do not trust a size change when conversion is active

From
tboegi@web.de <tboegi@web.de>
Date
Nov 27, 2026, 19:42 UTC
Message-ID
<20261127194233.10069-1-tboegi@web.de>
In-Reply-To
<xmqqwm1no29m.fsf@gitster.g>
From: Torsten Bögershausen <tboegi@web.de>

This patch series was stalled, it seems. As agreed in the coooking thread: Lets try to move things forward, here comes my simplified summary:

When `git status` is run, git runs a lstat() on all files that are tracked. When all relevant fields of "struct stat" are the same as recorded in the index, the file is unchanged.

a) If mtime is changed, git must check if the file contents give
   the same blob (hash value) in the index.
b) If mtime is close to mtime of the index file itself,
   we can not trust ctime and the check is done as well (racy)
c) And there is a "shortcut":
   When a file has a different size on disk compared to what is recorded
   in the index, it -must- have a different content.
   However, ever since line ending conversions (CRLF -> LF) and input filters
   had been introduced, this assumption is no longer true.
   The file on disk must be converted
   (into the content that the next commit will have in the next commit)
   and re-hashed.
   And this is what the patch series is about.
   The short cut (different size -> different content)
   is removed for regular files.
   It is kept for for links, they don't undergo a conversion.

Patch 1 does the basic work and adds test cases. Patch 2 optimizes and updates the comments in read-cache.c

Comments welcome.
Curtis Allen Smith (1):
  read-cache: do not trust a size change when conversion is active
Torsten Bögershausen (1):
  read-cache: optimize file size change when conversion is active
 read-cache.c    | 17 ++++++++---------
 t/t0020-crlf.sh | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 9 deletions(-)
-- 
2.56.0.236.g7e34d8174d
Previous: tboegi@web.deNext: Junio C Hamano
Message 24 of 37 in “utf8.c: Prepare workaround for iconv under macOS 14/15”
  1. 1/2 utf8.c: Prepare workaround for iconv under macOS 14/15tboegi@web.de, Jan 11, 2026
  2. Junio C HamanoJan 12, 2026
  3. 1/2 utf8.c: Prepare workaround for iconv under macOS 14/15tboegi@web.de, Jan 12, 2026
  4. 0/2 Workaround for iconv under macOS 14/15tboegi@web.de, Jan 12, 2026
  5. 2/2 utf8.c: Enable workaround for iconv under macOS 14/15tboegi@web.de, Jan 12, 2026
  6. 0/1 read-cache: do not trust a size change when conversiontboegi@web.de, Oct 12, 2026
  7. 1/1 read-cache: do not trust a size change when conversion is activetboegi@web.de, Oct 12, 2026
  8. Junio C HamanoOct 12, 2026
  9. Junio C HamanoOct 13, 2026
  10. Curtis SmithOct 13, 2026
  11. Johannes SixtOct 13, 2026
  12. Curtis SmithOct 13, 2026
  13. read-cache: do not trust a size change when conversion is activeCurtis Allen Smith, Oct 13, 2026
  14. Phillip WoodOct 13, 2026
  15. Curtis SmithOct 13, 2026
  16. Torsten BögershausenOct 13, 2026
  17. read-cache: do not trust a size change when conversion is activeCurtis Allen Smith, Oct 13, 2026
  18. Junio C HamanoOct 13, 2026
  19. Torsten BögershausenOct 18, 2026
  20. Junio C HamanoOct 19, 2026
  21. Torsten BögershausenOct 20, 2026
  22. 0/1 More cs/read-cache-conversion-sizetboegi@web.de, Oct 26, 2026
  23. 1/1 read-cache: optimize file size change when conversion is activetboegi@web.de, Oct 26, 2026
  24. 0/2 read-cache: do not trust a size change when conversion is activetboegi@web.de, Nov 27, 2026
  25. Junio C HamanoNov 28, 2026
  26. 1/2 read-cache: do not trust a size change when conversion is activetboegi@web.de, Nov 27, 2026
  27. Junio C HamanoNov 28, 2026
  28. Torsten BögershausenNov 28, 2026
  29. Junio C HamanoNov 29, 2026
  30. 2/2 read-cache: optimize file size change when conversion is activetboegi@web.de, Nov 27, 2026
  31. Junio C HamanoNov 28, 2026
  32. 1/1 read-cache: do not trust a size change when conversion is activetboegi@web.de, Nov 29, 2026
  33. Junio C HamanoNov 29, 2026
  34. Junio C HamanoNov 29, 2026
  35. Junio C HamanoNov 29, 2026
  36. Torsten BögershausenNov 29, 2026
  37. Junio C HamanoNov 29, 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.