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

Re: [PATCH v5] read-cache: do not trust a size change when conversion is active

From
Torsten Bögershausen <tboegi@web.de>
Date
Oct 20, 2026, 20:56 UTC
Message-ID
<20261020205644.GB6367@tb-raspi4>
In-Reply-To
<20261013180206.610-1-curtis.allen.smith@gmail.com>

On Tue, Oct 13, 2026 at 12:02:04PM -0600, Curtis Allen Smith wrote: [snip]

Show 22 quoted lines
> diff --git a/read-cache.c b/read-cache.c
> index c4cf08a3a..70f4787de 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -9,6 +9,7 @@
>  
>  #include "git-compat-util.h"
>  #include "config.h"
> +#include "convert.h"
>  #include "date.h"
>  #include "diff.h"
>  #include "diffcore.h"
> @@ -480,7 +481,8 @@ int ie_modified(struct index_state *istate,
>  	     */
>  	    (!S_ISLNK(st->st_mode) || ce->ce_stat_data.sd_size != MAX_PATH) &&
>  #endif
> -	    (S_ISGITLINK(ce->ce_mode) || ce->ce_stat_data.sd_size != 0))
> +	    (S_ISGITLINK(ce->ce_mode) || ce->ce_stat_data.sd_size != 0) &&
> +	    !(S_ISREG(st->st_mode) && would_convert_to_git(istate, ce->name)))
>  		return changed;
>  
>  	changed_fs = ce_modified_check_fs(istate, ce, st);

After some more code reading: I think that, if the (to be commited) content is unchanged and would_convert_to_git() return 0, we will do another check further down:

ce_modified_check_fs() will call ce_compare_data() which does the filter invokation and concludes that nothing has changed. The thing is that a changed file size of a regular file does not mean that the filtered file has changed. And removing this shortcut gives the following code (with all test cases passed)

#ifdef GIT_WINDOWS_NATIVE
            /*                                                                                                                                     * Work around Git for Windows v2.27.0 fixing a bug where symlinks'                                                                    * target path lengths were not read at all, and instead recorded                                                                      * as 4096: now, all symlinks would appear as modified.                                                                                *                                                                                                                                     * So let's just special-case symlinks with a target path length                                                                       * (i.e. `sd_size`) of 4096 and force them to be re-checked.                                                                           */
            (ce->ce_stat_data.sd_size != MAX_PATH) &&
#endif
            (S_ISGITLINK(ce->ce_mode)))
                return changed;
        changed_fs = ce_modified_check_fs(istate, ce, st);
        if (changed_fs)
                return changed | changed_fs;
        return 0;
}
Previous: Junio C HamanoNext: tboegi@web.de
Message 21 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.