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

Re: [PATCH] apply: support case-only renames in case-insensitive filesystems

From
Tao Klerks <tao@klerks.biz>
Date
Jun 14, 2022, 06:22 UTC
Message-ID
<CAPMMpogcm36pd7fjvG64G7Vg29arukF-wzOKYbNYG9NOpVCXvQ@mail.gmail.com>
In-Reply-To
<xmqqedzt8nfq.fsf@gitster.g>
On Mon, Jun 13, 2022 at 1:35 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
>
> Junio C Hamano <gitster@pobox.com> writes:
>
> > ...  I
> > do not think in_fn_table() pays attention to "ignore_case" option,
> > so there may be an existing bug there already, regardless of the
> > problem you are trying to address with your patch.
> >
> > And I wonder if doing case-insensitive match in in_fn_table() lets
> > us cover this new case as well as "fixing" the existing issue.
>
> While I still think in_fn_table() should be looked into for an
> existing case sensitivity bug, I think this one is different enough
> that in_fn_table() logic wouild not trigger for it, and a patch to
> add an extra piece of logic for renames is probably needed.
>

Having spent some time with this yesterday and today, I'm quite confident not only that you were right about the general case-sensitivity fix required here, but also that it fixes the case-only rename issue. It turns it (on case-insensitive filesystems) into a similar issue to the mode change, which is treated as a remove and add of the same file.

As you suggested, it is possible to construct "case-differing file swaps" which are not file swaps on a case-sensitive FS but are on a case-insensitive one, and without a fix these fail. The same (very small) change fixes both issues.

Show 9 quoted lines
> It might be sufficient to tighten the condition so that it triggers
> only to the case you wanted to handle, i.e. a rename between the
> same name.
>
>         else if (ignore_case && old_name && new_name &&
>                  !strcasecmp(old_name, new_name))
>
> (the "both names must be non-NULL" check is new).
>

This was my original tack, but I think it makes more sense to make the general fix and explain how it also handles this case.

New patch coming.
Thanks!
Previous: Junio C HamanoNext: Tao Klerks
Message 4 of 21 in “apply: support case-only renames in case-insensitive filesystems”
  1. apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, Jun 11, 2022
  2. Junio C HamanoJun 11, 2022
  3. Junio C HamanoJun 12, 2022
  4. Tao KlerksJun 14, 2022
  5. Tao KlerksJun 15, 2022
  6. Tao KlerksJun 14, 2022
  7. Junio C HamanoJun 18, 2022
  8. Tao KlerksJun 18, 2022
  9. Junio C HamanoJun 12, 2022
  10. Junio C HamanoJun 13, 2022
  11. Tao KlerksJun 14, 2022
  12. Tao KlerksJun 14, 2022
  13. 0/3 RFC: apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, Jun 19, 2022
  14. 2/3 reset: new failing test for reset of case-insensitive duplicate in indexTao Klerks via GitGitGadget, Jun 19, 2022
  15. 1/3 t4141: test "git apply" with core.ignorecaseJunio C Hamano via GitGitGadget, Jun 19, 2022
  16. 3/3 apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, Jun 19, 2022
  17. Tao KlerksOct 10, 2022
  18. 0/3 apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, May 28, 2023
  19. 2/3 reset: new failing test for reset of case-insensitive duplicate in indexTao Klerks via GitGitGadget, May 28, 2023
  20. 1/3 t4142: test "git apply" with core.ignorecaseJunio C Hamano via GitGitGadget, May 28, 2023
  21. 3/3 apply: support case-only renames in case-insensitive filesystemsTao Klerks via GitGitGadget, May 28, 2023

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.