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

Re: [PATCH] t3910: show failure of core.precomposeunicode with decomposed filenames

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 28, 2014, 19:17 UTC
Message-ID
<xmqqbnvlqn5j.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140428161630.GA9435@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> This patch just adds a test to demonstrate the breakage.
> Some possible fixes are:
> ...
>   2. Do all index filename comparisons using a UTF-8 aware
>      comparison function when core.precomposeunicode is set.
>      This would probably have bad performance, and somewhat
>      defeats the point of converting the filenames at the
>      readdir level in the first place.

As we do this only when core.precomposeunicode is set, projects that use pathnames encoded not in UTF-8 (e.g. 8859-1, EUC, etc.) will not be affected by getting their path mangled, as long as we won't flip the default to true (which I am not suggesting to do, by the way).

>   3. Convert index filenames to their precomposed form when
>      we read the index from disk. This would be efficient,
>      but we would have to be careful not to write the
>      precomposed forms back out to disk.

I think this may be the right approach, especially if you are going to do this only when core.precomposeunicode is set.

the reasoning behind "we would have to be careful not to write" part, is unclear to me, though. Don't decomposing filesystems perform the manglig from the precomposed form without even being asked to do so, just like a case insensitive filesystem will overwrite an existing "makefile" on a request to write to "Makefile"?

Show 32 quoted lines
>   4. Introduce some infrastructure to efficiently match up
>      the precomposed/decomposed forms. We already do
>      something similar for case-insensitive files using
>      name-hash.c. We might be able to adapt that strategy
>      here.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  t/t3910-mac-os-precompose.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/t/t3910-mac-os-precompose.sh b/t/t3910-mac-os-precompose.sh
> index e4ba601..23aa61e 100755
> --- a/t/t3910-mac-os-precompose.sh
> +++ b/t/t3910-mac-os-precompose.sh
> @@ -140,6 +140,16 @@ test_expect_success "Add long precomposed filename" '
>  	git add * &&
>  	git commit -m "Long filename"
>  '
> +
> +test_expect_failure 'handle existing decomposed filenames' '
> +	echo content >"verbatim.$Adiarnfd" &&
> +	git -c core.precomposeunicode=false add "verbatim.$Adiarnfd" &&
> +	git commit -m "existing decomposed file" &&
> +	>expect &&
> +	git ls-files --exclude-standard -o "verbatim*" >untracked &&
> +	test_cmp expect untracked
> +'
> +
>  # Test if the global core.precomposeunicode stops autosensing
>  # Must be the last test case
>  test_expect_success "respect git config --global core.precomposeunicode" '
Previous: Jeff KingNext: Jeff King
Message 2 of 19 in “t3910: show failure of core.precomposeunicode with decomposed filenames”
  1. t3910: show failure of core.precomposeunicode with decomposed filenamesJeff King, Apr 28, 2014
  2. Junio C HamanoApr 28, 2014
  3. Jeff KingApr 28, 2014
  4. Torsten BögershausenApr 28, 2014
  5. Jeff KingApr 28, 2014
  6. Torsten BögershausenApr 28, 2014
  7. Jeff KingApr 29, 2014
  8. Torsten BögershausenApr 29, 2014
  9. Jeff KingApr 29, 2014
  10. Junio C HamanoApr 29, 2014
  11. Jeff KingApr 29, 2014
  12. Junio C HamanoApr 29, 2014
  13. Jeff KingApr 29, 2014
  14. Torsten BögershausenApr 30, 2014
  15. Torsten BögershausenMay 4, 2014
  16. Torsten BögershausenMay 4, 2014
  17. Jeff KingMay 5, 2014
  18. Erik Faye-LundMay 6, 2014
  19. Torsten BögershausenMay 7, 2014

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.