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

Re: [PATCH v1] name-hash: properly fold directory names in adjust_dirname_case()

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 8, 2018, 18:20 UTC
Message-ID
<xmqqlgg35on4.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180208004156.36224-1-benpeart@microsoft.com>
Ben Peart <benpeart@microsoft.com> writes:
Show 10 quoted lines
> Correct the pointer arithmetic in adjust_dirname_case() so that it calls
> find_dir_entry() with the correct string length.  Previously passing in
> "dir1/foo" would pass a length of 6 instead of the correct 4.  This resulted in
> find_dir_entry() never finding the entry and so the subsequent memcpy that would
> fold the name to the version with the correct case never executed.
>
> Add a test to validate the corrected behavior with name folding of directories.
>
> Signed-off-by: Ben Peart <benpeart@microsoft.com>
> ---
Thanks.

It appears that this codepath has been miscounting ever since it was introduced in 41284eb0 ("name-hash: don't reuse cache_entry in dir_entry", 2015-10-21).

Show 10 quoted lines
> diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
> index b29d749bb7..219c96594c 100755
> --- a/t/t0050-filesystem.sh
> +++ b/t/t0050-filesystem.sh
> @@ -80,7 +80,17 @@ test_expect_success 'merge (case change)' '
> ...
> +test_expect_success CASE_INSENSITIVE_FS 'add directory (with different case)' '
> +	git reset --hard initial &&
> +	mkdir -p dir1 &&
> +	mkdir -p dir1/dir2 &&
A single "mkdir -p dir1/dir2" should be sufficient, thanks to "-p" ;-)
> +	touch dir1/dir2/a &&
> +	touch dir1/dir2/b &&
Hmph.
Previous: Junio C HamanoNext: Ben Peart
Message 6 of 8 in “name-hash: properly fold directory names in adjust_dirname_case()”
  1. name-hash: properly fold directory names in adjust_dirname_case()Ben Peart, Feb 8, 2018
  2. David TurnerFeb 8, 2018
  3. Torsten BögershausenFeb 8, 2018
  4. Ben PeartFeb 8, 2018
  5. Junio C HamanoFeb 8, 2018
  6. Junio C HamanoFeb 8, 2018
  7. name-hash: properly fold directory names in adjust_dirname_case()Ben Peart, Feb 8, 2018
  8. Torsten BögershausenFeb 9, 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.