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

Re: icase pathspec magic support in ls-tree

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 30, 2022, 13:53 UTC
Message-ID
<220930.86r0ztufwd.gmgdl@evledraar.gmail.com>
In-Reply-To
<CAPMMpogcnwJDUazw82OB0DvdgvNS6hpUN9Qs69ppTFb1QFbLSg@mail.gmail.com>
On Fri, Sep 30 2022, Tao Klerks wrote:
Show 28 quoted lines
> Hi folks,
>
> I just found out today both that icase magic exists (awesome!), and
> that it isn't supported in ls-tree (boo).
>
> As far as I can tell, getting it supported would be the only way to
> *efficiently* prevent caseless-duplicate files from being created in a
> repo, in an "update" hook: I'd want to call ls-tree on the new head
> commit for the branch, passing in an icase pathspec for all the files
> being added since the previous state - and then sort and uniq.
>
> Of course, for entirely new branches I'd have to do a full check of
> the tree, and for very large changes that might be the fastest/best
> thing to do anyway, rather than creating a silly-sized pathspec - but
> checking the full tree costs me about 1 second, a price that I'm loath
> to pay for everyday commit verifications of a handful of files, vs a
> 200,000-file full tree.
>
> I tried changing ls-tree "naively" to just permit the icase magic,
> without any logic changes, and found at least one case where it
> doesn't work: when combining wildcards with case-insensitivity, like
> an icased "T/*" patchspec in the git repo; ls-files finds all the
> tests, and a naively updated ls-tree does not.
>
> I think I see the last person to update this was Nguyễn Thái Ngọc Duy
> in 2013, giving a hint as to what would need to be done to make this
> be supported; is this an area anyone else might be looking at at the
> moment?

You might find ASCII-only sufficient, but note that even if you get this working you won't catch the more complex Unicode normalization rules various filesystems perform, see the fsck code we carefully crafted to make sure we don't get something those FS's will mistake for a ".git" directory in-tree.

Previous: Tao KlerksNext: brian m. carlson
Message 2 of 16 in “icase pathspec magic support in ls-tree”
  1. Tao KlerksSep 30, 2022
  2. Ævar Arnfjörð BjarmasonSep 30, 2022
  3. brian m. carlsonOct 2, 2022
  4. Tao KlerksOct 13, 2022
  5. Torsten BögershausenOct 14, 2022
  6. Tao KlerksOct 14, 2022
  7. Erik Cervin EdinOct 14, 2022
  8. Elijah NewrenOct 14, 2022
  9. Erik Cervin EdinOct 14, 2022
  10. Tao KlerksOct 14, 2022
  11. Tao KlerksOct 14, 2022
  12. Tao KlerksOct 14, 2022
  13. Erik Cervin EdinOct 14, 2022
  14. Elijah NewrenOct 14, 2022
  15. Tao KlerksOct 15, 2022
  16. Tao KlerksOct 17, 2022

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.